]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rsd.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavformat / rsd.c
index 37e544acb1feb6b1bbfdd361707a43a8148745eb..341f638c77ca15fbb4c107398bb2d153f910ad01 100644 (file)
@@ -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 AVPROBE_SCORE_MAX / 8;
+    if (AV_RL32(p->buf + 16) > 8*48000 || !AV_RL32(p->buf + 16))
+        return AVPROBE_SCORE_MAX / 8;
+    return AVPROBE_SCORE_MAX;
 }
 
 static int rsd_read_header(AVFormatContext *s)