GNOME Bugzilla – Bug 158033
Error reading BMP files with negative height!
Last modified: 2005-01-14 19:02:00 UTC
I find out this bug working on my own Bitmap writer. According to: http://msdn.microsoft.com/library/default.asp?url=/library/en- us/gdi/bitmaps_1rw2.asp "[...] If biHeight is positive, the bitmap is a bottom-up DIB and its origin is the lower-left corner. If biHeight is negative, the bitmap is a top-down DIB and its origin is the upper-left corner. If biHeight is negative, indicating a top-down DIB, biCompression must be either BI_RGB or BI_BITFIELDS. Top-down DIBs cannot be compressed. [...]" If you load a bmp with negative height gimp crashes because bmp plugin or libgimp check for height>0 during loading... I hope this can help you... Bye, Andrea Fontana
Could you attach such a BMP file to this bug report, please.
We are still waiting for an example file to be attached here.
Created attachment 35960 [details] A bmp with negative height
re-opening because reporter has responded with requested info
The attached file is actually a zip file, which unzips to create a file called Test.bmp. (It took me about an hour to figure this out.)
'file' is your friend
I'm sorry, i'm a newbie with bugzilla, i'm trying to help community.
Probably i can't use attachments so well :)
Okay, fixed in CVS head. 2005-01-13 Bill Skaggs <weskaggs@primate.ucdavis.edu> * plug-ins/bmp/bmp.h * plug-ins/bmp/bmpread.c: handle negative height values as per spec, fixes bug #158033
Unfortunately the only way to let people know in Bugzilla that the attachment is an archive or a compressed file is to add a comment saying so.
I hope that if height is negative you handle bmp as topdown bitmap...
Regarding comment #10: Another way is to specify a proper mime-type for the attachment, which is excatly what Andrea did.
This fix should probably be backported to GIMP 2.2. Reopening and setting the milestone accordingly.
2005-01-14 Sven Neumann <sven@gimp.org> Merged from HEAD branch (fix by Bill Skaggs): * plug-ins/bmp/bmp.h * plug-ins/bmp/bmpread.c: handle negative height values as per spec, fixes bug #158033
I'm not blaming anybody, but just to explain, the unfortunate thing is that in Bugzilla every attachment is called "attachment.cgi.html", regardless of what it is, so if I see an attachment described as "A bmp with negative height", it is natural for me to Save Link Target As... and call the result test.bmp. I then try to open the result in GIMP, see it fail as expected, and spend quite some time trying to pin down the error before realizing that this isn't actually a bmp file. But there is no way for you to have realized this would happen, so there is no blame. And yes, the image gets flipped after loading if the height value is negative.
Bill, I suggest instead of saving, you simply click on the attachment. Bugzilla will serve it with the proper mime-type then, which should have sent it to file-roller or whatever archiver is configured in your browser.