atrac3dec: Check coding mode against channels.
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 9 Nov 2012 12:26:20 +0000 (13:26 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 9 Nov 2012 12:26:20 +0000 (13:26 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/atrac3.c

index abc2927..101a887 100644 (file)
@@ -916,6 +916,11 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
         return AVERROR(EINVAL);
     }
 
+    if (q->coding_mode == JOINT_STEREO && avctx->channels < 2) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid coding mode\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     /* Check the extradata */
 
     if (version != 4) {