wmadec: Verify bitstream size makes sense before calling init_get_bits.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 48f1e5212c
)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
This commit is contained in:

committed by
Reinhard Tartler

parent
19da1a39e8
commit
fecd7468fc
@@ -877,6 +877,8 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
|
|||||||
|
|
||||||
/* read each frame starting from bit_offset */
|
/* read each frame starting from bit_offset */
|
||||||
pos = bit_offset + 4 + 4 + s->byte_offset_bits + 3;
|
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);
|
init_get_bits(&s->gb, buf + (pos >> 3), (MAX_CODED_SUPERFRAME_SIZE - (pos >> 3))*8);
|
||||||
len = pos & 7;
|
len = pos & 7;
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
|
Reference in New Issue
Block a user