]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
ADTS: Increased protection against writing illegal/nonsense files.
authoralexc <alexc@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Fri, 6 Mar 2009 21:19:16 +0000 (21:19 +0000)
committeralexc <alexc@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Fri, 6 Mar 2009 21:19:16 +0000 (21:19 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@17859 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavformat/adtsenc.c

index 9916b92ac6ddf6032b080886dc528e2c1f0861a5..70e252e2b692ff3107e96960263ee4f8194d99ca 100644 (file)
@@ -42,7 +42,7 @@ static int decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf,
     adts->sample_rate_index = get_bits(&gb, 4);
     adts->channel_conf = get_bits(&gb, 4);
 
-    if (adts->objecttype > 3) {
+    if (adts->objecttype > 3U) {
         av_log(s, AV_LOG_ERROR, "MPEG-4 AOT %d is not allowed in ADTS\n", adts->objecttype+1);
         return -1;
     }
@@ -54,6 +54,18 @@ static int decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf,
         ff_log_missing_feature(s, "PCE based channel configuration", 0);
         return -1;
     }
+    if (get_bits(&gb, 1)) {
+        av_log(s, AV_LOG_ERROR, "960/120 MDCT window is not allowed in ADTS\n");
+        return -1;
+    }
+    if (get_bits(&gb, 1)) {
+        av_log(s, AV_LOG_ERROR, "Scalable configurations are not allowed in ADTS\n");
+        return -1;
+    }
+    if (get_bits(&gb, 1)) {
+        ff_log_missing_feature(s, "Signaled SBR or PS", 0);
+        return -1;
+    }
 
     adts->write_adts = 1;