[FFmpeg-cvslog] avformat/diracdec: check 2 chunks in probe

Michael Niedermayer git at videolan.org
Sun Nov 10 17:35:39 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Nov 10 16:04:33 2013 +0100| [2fbc759d08cae97f9361e464a685a149c9d12c72] | committer: Michael Niedermayer

avformat/diracdec: check 2 chunks in probe

Fixes probetest failure

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2fbc759d08cae97f9361e464a685a149c9d12c72
---

 libavformat/diracdec.c |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/libavformat/diracdec.c b/libavformat/diracdec.c
index 6636ead..e061ba5 100644
--- a/libavformat/diracdec.c
+++ b/libavformat/diracdec.c
@@ -25,10 +25,19 @@
 
 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)



More information about the ffmpeg-cvslog mailing list