GNOME Bugzilla – Bug 694950
BMP image has bogus header data error message on loading some BMP files
Last modified: 2014-10-26 11:11:07 UTC
Hi, I created some BMP image files using the Microsoft AMCap2 program. Programs which use gdk-pixbuf to load the image fail, giving an error message "BMP image has bogus header data". For example gpicview and qiv give that error. The images are viewable with Firefox, and also PNGOUT processes them correctly. Attached is a sample image, both original BMP and a PNG created from it using PNGOUT.
Created attachment 237731 [details] PNG version of the same image, showing what it should look like
Created attachment 237732 [details] BMP image, compressed with bzip2
Reproduced with gdk-pixbuf 2.31.
The error was from the: if (State->Header.n_colors > (1 << State->Header.depth)) { error path. It seems to be bogus as removing it fixes the problem. commit 3c9c6b0c8330ebbd1b9557b9fc3c68020dc394b5 Author: Bastien Nocera <hadess@hadess.net> Date: Sun Oct 26 12:08:21 2014 +0100 bmp: Fix reading of MS AMCap2 generated files Remove bogus number of colours check. I could not find any BMP readers that used this sort of checks and removing it makes MS AMCap2 generated files load properly. https://bugzilla.gnome.org/show_bug.cgi?id=694950