diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index 479b34c3e0..c8e1de2c32 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -864,6 +864,8 @@ static int wma_decode_superframe(AVCodecContext *avctx, /* read each frame starting from bit_offset */ pos = bit_offset + 4 + 4 + s->byte_offset_bits + 3; + if (pos >= MAX_CODED_SUPERFRAME_SIZE * 8) + return AVERROR_INVALIDDATA; init_get_bits(&s->gb, buf + (pos >> 3), (MAX_CODED_SUPERFRAME_SIZE - (pos >> 3))*8); len = pos & 7; if (len > 0)