[CLOSED] Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
Portiella
Posts: 17
Joined: 2018-12-05T07:30:35-07:00
Authentication code: 1152

[CLOSED] Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Post 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
Last edited by Portiella on 2018-12-27T04:36:37-07:00, edited 1 time in total.
Portiella
Posts: 17
Joined: 2018-12-05T07:30:35-07:00
Authentication code: 1152

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Post by Portiella »

can someone try on XP?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Post 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?
snibgo's IM pages: im.snibgo.com
Portiella
Posts: 17
Joined: 2018-12-05T07:30:35-07:00
Authentication code: 1152

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Post by snibgo »

Did you rebuild your exe on the XP platform, or did you simply copy the exe from the Windows 10 platform?
snibgo's IM pages: im.snibgo.com
Portiella
Posts: 17
Joined: 2018-12-05T07:30:35-07:00
Authentication code: 1152

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Post by Portiella »

I configure Visual Studio 2017 to compile XP target.
Portiella
Posts: 17
Joined: 2018-12-05T07:30:35-07:00
Authentication code: 1152

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Post 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
Portiella
Posts: 17
Joined: 2018-12-05T07:30:35-07:00
Authentication code: 1152

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Post 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.
Portiella
Posts: 17
Joined: 2018-12-05T07:30:35-07:00
Authentication code: 1152

Re: Error InsufficientImageDataInFile / LengthAndFilesizeDoNotMatch

Post 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
Post Reply