changeset 4666:bf7e0b55d9ec libavformat

ADTS: Increased protection against writing illegal/nonsense files.
author alexc
date Fri, 06 Mar 2009 21:19:16 +0000
parents aed6cf383ca2
children 7d88e3f6943d
files adtsenc.c
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/adtsenc.c	Fri Mar 06 20:51:50 2009 +0000
+++ b/adtsenc.c	Fri Mar 06 21:19:16 2009 +0000
@@ -42,7 +42,7 @@
     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 @@
         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;