[FFmpeg-cvslog] avformat/rsd: Check channels and sample_rate fields

Michael Niedermayer git at videolan.org
Wed Nov 6 11:58:47 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Nov  6 11:48:49 2013 +0100| [50a3c4c5d2634b5d4076a5b7c099729cbd59ac45] | committer: Michael Niedermayer

avformat/rsd: Check channels and sample_rate fields

Fixes probetest failure

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

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

 libavformat/rsd.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavformat/rsd.c b/libavformat/rsd.c
index 37e544a..7fad3e6 100644
--- a/libavformat/rsd.c
+++ b/libavformat/rsd.c
@@ -43,10 +43,13 @@ static const uint32_t rsd_unsupported_tags[] = {
 
 static int rsd_probe(AVProbeData *p)
 {
-    if (!memcmp(p->buf, "RSD", 3) &&
-        p->buf[3] - '0' >= 2 && p->buf[3] - '0' <= 6)
-        return AVPROBE_SCORE_EXTENSION;
-    return 0;
+    if (memcmp(p->buf, "RSD", 3) || p->buf[3] - '0' < 2 || p->buf[3] - '0' > 6)
+        return 0;
+    if (AV_RL32(p->buf +  8) > 256 || !AV_RL32(p->buf +  8))
+        return 1;
+    if (AV_RL32(p->buf + 16) > 8*48000 || !AV_RL32(p->buf + 16))
+        return 1;
+    return AVPROBE_SCORE_EXTENSION;
 }
 
 static int rsd_read_header(AVFormatContext *s)



More information about the ffmpeg-cvslog mailing list