Opened 11 years ago
Closed 10 years ago
#3687 closed defect (fixed)
bmp parser is more strict than the bmp decoder
Reported by: | Carl Eugen Hoyos | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | bmp |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
I will attach a bmp sample with incorrect written size, the file decodes fine with lavc, the parser breaks it.
$ cat 8bpp.bmp | ./ffmpeg -f image2pipe -vcodec bmp -i - out.png ffmpeg version N-63596-g772d46d Copyright (c) 2000-2014 the FFmpeg developers built on May 30 2014 05:16:07 with gcc 4.7 (SUSE Linux) configuration: --enable-gpl --enable-libspeex libavutil 52. 87.100 / 52. 87.100 libavcodec 55. 65.100 / 55. 65.100 libavformat 55. 42.100 / 55. 42.100 libavdevice 55. 13.101 / 55. 13.101 libavfilter 4. 5.100 / 4. 5.100 libswscale 2. 6.100 / 2. 6.100 libswresample 0. 19.100 / 0. 19.100 libpostproc 52. 3.100 / 52. 3.100 [bmp @ 0x212a980] not enough data (785408 < 786432) Input #0, image2pipe, from 'pipe:': Duration: N/A, bitrate: N/A Stream #0:0: Video: bmp, pal8, 1024x768, 25 tbr, 25 tbn, 25 tbc File 'out.png' already exists. Exiting.
Attachments (1)
Change History (5)
by , 11 years ago
comment:1 by , 11 years ago
comment:2 by , 10 years ago
This is now simpler to reproduce:
$ cp 8bpp.bmp bmpimage
$ ffmpeg -i bmpimage out.png ffmpeg version N-64397-g5c65aed Copyright (c) 2000-2014 the FFmpeg developers built on Jul 4 2014 01:47:20 with gcc 4.7 (SUSE Linux) configuration: --enable-gpl libavutil 52. 90.101 / 52. 90.101 libavcodec 55. 68.100 / 55. 68.100 libavformat 55. 45.100 / 55. 45.100 libavdevice 55. 13.101 / 55. 13.101 libavfilter 4. 10.100 / 4. 10.100 libswscale 2. 6.100 / 2. 6.100 libswresample 0. 19.100 / 0. 19.100 libpostproc 52. 3.100 / 52. 3.100 [bmp @ 0x1f3ba80] not enough data (785408 < 786432) Input #0, bmp_pipe, from 'bmpimage': Duration: N/A, bitrate: N/A Stream #0:0: Video: bmp, pal8, 1024x768, 25 tbr, 25 tbn, 25 tbc [image2 @ 0x1f3c9c0] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead. Output #0, image2, to 'out.png': Metadata: encoder : Lavf55.45.100 Stream #0:0: Video: png, pal8, 1024x768, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc Metadata: encoder : Lavc55.68.100 png Stream mapping: Stream #0:0 -> #0:0 (bmp (native) -> png (native)) Press [q] to stop, [?] for help [bmp @ 0x1f3c520] not enough data (785408 < 786432) Error while decoding stream #0:0: Invalid data found when processing input bmpimage: Input/output error frame= 0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used) Conversion failed!
comment:4 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
I guess the parser would have to parse more of the header to figure out the correct size.
Simply using a 16bit header to find the next image feels a bit unreliable to me