[FFmpeg-devel] [PATCH] Ignore file size field in BMP header

Daniel Verkamp daniel
Mon Nov 24 05:50:52 CET 2008

This patch removes the reading and checking of the file size field in
the BMP decoder (known as bfSize in the MS docs).

This field is documented (see MSDN page for BITMAPFILEHEADER) as
containing the size of the file, but other sources document it as
containing the size of just the file header or the size of all the
headers.  This is seen in some files in the wild; for example:

http://samples.mplayerhq.hu/bmp-files/rmoney.bmp has 14 in this field
(size of file header)
http://samples.mplayerhq.hu/bmp-files/test4os2v2.bmp has 78 (size of
all headers)

This field isn't necessary to decode the bitmap correctly, so the
patch removes the read and checks (the second check is changed to use
the buffer size instead of the file size from the header).

The patch fixes loading of rmoney.bmp; test4os2v2.bmp is OS/2 V2
(different header size), so does not yet decode.

-- Daniel Verkamp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Ignore-file-size-field-in-BMP-header.patch
Type: application/octet-stream
Size: 1400 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081123/bf2d912d/attachment.obj>

More information about the ffmpeg-devel mailing list