From 50f0a6b4e64b78e0df1919ee1fa5e805309911c2 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 14 Nov 2012 21:14:40 +0100 Subject: [PATCH] wmaprodec: check num_sfb for validity. Fix out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavcodec/wmaprodec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index e071eb1f95..c5cc46b5ce 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -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; + } }