wmaprodec: check num_sfb for validity. Fix out of array accesses
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 14 Nov 2012 20:14:40 +0000 (21:14 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 14 Nov 2012 20:15:08 +0000 (21:15 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/wmaprodec.c

index e071eb1..c5cc46b 100644 (file)
@@ -412,6 +412,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
         }
         s->sfb_offsets[i][band - 1] = subframe_len;
         s->num_sfb[i]               = band - 1;
+        if (s->num_sfb[i] <= 0) {
+            av_log(avctx, AV_LOG_ERROR, "num_sfb invalid\n");
+            return AVERROR_INVALIDDATA;
+        }
     }