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

Kostya kostya.shishkov
Mon Nov 24 08:09:51 CET 2008

On Sun, Nov 23, 2008 at 10:50:52PM -0600, Daniel Verkamp wrote:
> 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).

It is but dropping checks completely is not a good idea either.
I will try to devise something more robust instead.
> The patch fixes loading of rmoney.bmp; test4os2v2.bmp is OS/2 V2
> (different header size), so does not yet decode.
> -- Daniel Verkamp

More information about the ffmpeg-devel mailing list