Browse code

adx: check for unsupported ADX formats

Justin Ruggles authored on 2011/11/21 07:07:59
Showing 1 changed files
... ...
@@ -89,6 +89,12 @@ static int adx_decode_header(AVCodecContext *avctx, const uint8_t *buf,
89 89
     if (bufsize < offset || memcmp(buf + offset - 6, "(c)CRI", 6))
90 90
         return AVERROR_INVALIDDATA;
91 91
 
92
+    /* check for encoding=3 block_size=18, sample_size=4 */
93
+    if (buf[4] != 3 || buf[5] != 18 || buf[6] != 4) {
94
+        av_log_ask_for_sample(avctx, "unsupported ADX format\n");
95
+        return AVERROR_PATCHWELCOME;
96
+    }
97
+
92 98
     c->channels = avctx->channels = buf[7];
93 99
     if (avctx->channels > 2)
94 100
         return AVERROR_INVALIDDATA;