diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-07-04 04:54:52 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-07-04 04:54:52 +0200 |
commit | c277ab6b78892bcd748b3e9d8cd4891b3764a025 (patch) | |
tree | 99ab36569cd9b7ee63eaee53a13f6305a0aafc50 | |
parent | d36fe733c1e84c7fc0e865d8ad73933e7bc92348 (diff) | |
download | ffmpeg-c277ab6b78892bcd748b3e9d8cd4891b3764a025.tar.gz |
avformat/img2dec: improve bmp probe
fix probetest failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/img2dec.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index cc53409c69..b1fa8cc987 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -564,13 +564,20 @@ AVInputFormat ff_image2pipe_demuxer = { static int bmp_probe(AVProbeData *p) { const uint8_t *b = p->buf; + int ihsize; - if (AV_RB16(b) == 0x424d) - if (!AV_RN32(b + 6)) { - return AVPROBE_SCORE_EXTENSION + 1; - } else { - return AVPROBE_SCORE_EXTENSION / 4; - } + if (AV_RB16(b) != 0x424d) + return 0; + + ihsize = AV_RL32(b+14); + if (ihsize < 12 || ihsize > 255) + return 0; + + if (!AV_RN32(b + 6)) { + return AVPROBE_SCORE_EXTENSION + 1; + } else { + return AVPROBE_SCORE_EXTENSION / 4; + } return 0; } |