Page 1 of 1

[CLOSED] Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Posted: 2018-12-05T07:37:01-07:00
by Portiella
Hello,

I have an exe compiled in visual studio 2017 with magick ++ 7.0.8-15.
If I try to read a JPG or BMP file (I have not tried with others) I get an error "InsufficientImageDataInFile" (in jpg) "LengthAndFilesizeDoNotMatch" (in bmp) but only in Windows XP, in Windows 10 it works perfectly.

What happens?

Thxs

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Posted: 2018-12-19T03:18:50-07:00
by Portiella
can someone try on XP?

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Posted: 2018-12-19T10:23:14-07:00
by magick
ImageMagick has a number of sanity checks for the image readers to help prevent security vectors caused by malformed images. Can you post your image here or post a link so we can download it. We need to reproduce the problem to determine if ImageMagick is being overly aggressive in its sanity checks or if the image is indeed malformed.

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Posted: 2018-12-19T10:56:45-07:00
by snibgo
Portiella wrote:What happens?
Does this happen with all JPG and BMP files? If so, perhaps there is an installation problem. Did you rebuild the exe on both platforms, or did you copy the exe from one platform to the other, on the assumption that libraries were identical on both?

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Posted: 2018-12-20T08:13:38-07:00
by Portiella
It happens to me with all the images, jpg, bmp, tiff, images recorded with Microsoft Paint I also get error. It is not a problem of jpg bmp files

I am convinced that it is something of my code or visual studio 2017, but the same exe and same images in Windows 7/10 works perfectly.

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Posted: 2018-12-20T08:40:46-07:00
by snibgo
Did you rebuild your exe on the XP platform, or did you simply copy the exe from the Windows 10 platform?

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Posted: 2018-12-20T08:45:13-07:00
by Portiella
I configure Visual Studio 2017 to compile XP target.

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Posted: 2018-12-20T09:02:54-07:00
by Portiella
Doing debug in bmp.c, on line number 826 I modified
if ((MagickSizeType) bmp_info.file_size > GetBlobSize(image))
(void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError,
"LengthAndFilesizeDoNotMatch","`%s' sizeBMP: %u sizeBlob: %u", image->filename, bmp_info.file_size, GetBlobSize(image));

the "GetBlobSize (image)" function returns 0

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Posted: 2018-12-24T01:42:06-07:00
by Portiella
What are the reasons for the GetBlobSize function to return 0?
It is the same source code and same EXE for XP and Windows 10.
In 7/10, it works perfectly.

Thx.

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Posted: 2018-12-26T05:15:31-07:00
by Portiella
I have compiled the IMDisplay.exe utility for XP with Visual Studio 2017 and it does not work, it gives the same error, so it is not my source code.
Both imagemagick and graphicsmagick do not work on XP compiled with Visual Studio 2017.

I tried to install Visual Studio 2017 in Windows XP but I have not been able