OSDN Git Service

avformat/diracdec: check 2 chunks in probe
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 10 Nov 2013 15:04:33 +0000 (16:04 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 10 Nov 2013 15:06:16 +0000 (16:06 +0100)
Fixes probetest failure

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/diracdec.c

index 6636ead..e061ba5 100644 (file)
 
 static int dirac_probe(AVProbeData *p)
 {
-    if (AV_RL32(p->buf) == MKTAG('B', 'B', 'C', 'D'))
-        return AVPROBE_SCORE_MAX;
-    else
+    unsigned size;
+    if (AV_RL32(p->buf) != MKTAG('B', 'B', 'C', 'D'))
         return 0;
+
+    size = AV_RB32(p->buf+5);
+    if (size < 13)
+        return 0;
+    if (size + 13LL > p->buf_size)
+        return AVPROBE_SCORE_MAX / 4;
+    if (AV_RL32(p->buf + size) != MKTAG('B', 'B', 'C', 'D'))
+        return 0;
+
+    return AVPROBE_SCORE_MAX;
 }
 
 FF_DEF_RAWVIDEO_DEMUXER(dirac, "raw Dirac", dirac_probe, NULL, AV_CODEC_ID_DIRAC)