[FFmpeg-cvslog] avformat/astdec: sanity check channels & sample rate

Michael Niedermayer git at videolan.org
Thu Nov 7 15:24:17 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Nov  6 13:12:59 2013 +0100| [cbe84b4ffae4619417e119ed63d7c49826feac81] | committer: Michael Niedermayer

avformat/astdec: sanity check channels & sample rate

Fixes probetest failure

Reviewed-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/astdec.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/libavformat/astdec.c b/libavformat/astdec.c
index 8862744..12252dc 100644
--- a/libavformat/astdec.c
+++ b/libavformat/astdec.c
@@ -27,12 +27,15 @@
 
 static int ast_probe(AVProbeData *p)
 {
-    if (AV_RL32(p->buf) == MKTAG('S','T','R','M') &&
-        AV_RB16(p->buf + 10) &&
-        AV_RB16(p->buf + 12) &&
-        AV_RB32(p->buf + 16))
-        return AVPROBE_SCORE_MAX / 3 * 2;
-    return 0;
+    if (AV_RL32(p->buf) != MKTAG('S','T','R','M'))
+        return 0;
+
+    if (!AV_RB16(p->buf + 10) ||
+        !AV_RB16(p->buf + 12) || AV_RB16(p->buf + 12) > 256 ||
+        !AV_RB32(p->buf + 16) || AV_RB32(p->buf + 16) > 8*48000)
+        return 1;
+
+    return AVPROBE_SCORE_MAX / 3 * 2;
 }
 
 static int ast_read_header(AVFormatContext *s)



More information about the ffmpeg-cvslog mailing list