eddieantonio/imgcat

read from NULL while cat a bmp file

frokaikan opened this issue · 1 comments

terminate called after throwing an instance of 'cimg_library::CImgArgumentException'
what(): cimg::fread(): Invalid reading request of 0 unsigned char from file 0x7453a0 to buffer (nil).

test.zip

Thanks for the bug report!

It appears that test.bmp is malformed. It sets its width as 0, which breaks nearly every image program I try to open this in. However, changing the 32-bit little endian number at byte 0x12 to 32—the actual width—I get the attached result:

fixed.bmp in imgcat

fixed.zip


While I don't think this is a bug in imgcat per se, it may be a bug in the library that imgcat uses—CImg. It crashes on bitmaps with width==0. I'll mark this as wontfix for this particular issue, but I do encourage you to file a bug report for CImg linking to this issue!