[FFmpeg-devel] [PATCH] Ignore file size field in BMP header
Mon Feb 16 08:54:33 CET 2009
On Mon, Feb 16, 2009 at 12:34:47AM -0600, Daniel Verkamp wrote:
> On Mon, Nov 24, 2008 at 1:09 AM, Kostya <kostya.shishkov at gmail.com> wrote:
> > 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 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.
> Sorry to revive this old thread, but I've been testing ffmpeg on media
> from various old shareware games, and I found another broken BMP with
> a nonsensical value in the file size field:
> [bmp @ 0x2a81050]not enough data (308278 < 1445367)
> I have no idea what software wrote this file, but it doesn't seem to
> follow any nice pattern like the other common broken files.
Relaxed the check a bit. I'm still not sure dropping it would be a good idea.
But BMP format is commonly violated, yes, so it leads developers to the thought
"hey, why bother checking, it's random anyway" and then comes somebody with
specially crafted file...
> Removing the checks completely allows it to decode correctly.
> -- Daniel Verkamp
More information about the ffmpeg-devel