apedec: fix global array overread
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 28 Mar 2012 08:30:44 +0000 (10:30 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 28 Mar 2012 08:30:44 +0000 (10:30 +0200)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/apedec.c

index 907f45f..4d0801b 100644 (file)
@@ -217,7 +217,7 @@ static av_cold int ape_decode_init(AVCodecContext *avctx)
 
     av_log(avctx, AV_LOG_DEBUG, "Compression Level: %d - Flags: %d\n",
            s->compression_level, s->flags);
-    if (s->compression_level % 1000 || s->compression_level > COMPRESSION_LEVEL_INSANE) {
+    if (s->compression_level % 1000 || s->compression_level > COMPRESSION_LEVEL_INSANE || !s->compression_level) {
         av_log(avctx, AV_LOG_ERROR, "Incorrect compression level %d\n",
                s->compression_level);
         return AVERROR_INVALIDDATA;