summaryrefslogtreecommitdiff
path: root/libavformat/img2dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-07-04 04:54:52 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-07-04 04:54:52 +0200
commitc277ab6b78892bcd748b3e9d8cd4891b3764a025 (patch)
tree99ab36569cd9b7ee63eaee53a13f6305a0aafc50 /libavformat/img2dec.c
parentd36fe733c1e84c7fc0e865d8ad73933e7bc92348 (diff)
avformat/img2dec: improve bmp probe
fix probetest failure Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/img2dec.c')
-rw-r--r--libavformat/img2dec.c19
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;
}