OSDN Git Service

avformat/astdec: sanity check channels & sample rate
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 6 Nov 2013 12:12:59 +0000 (13:12 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 7 Nov 2013 13:58:34 +0000 (14:58 +0100)
Fixes probetest failure

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

index 8862744..12252dc 100644 (file)
 
 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)