diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2013-06-28 04:03:47 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2013-06-28 13:15:40 +0200 |
commit | e30b068ef79f604ff439418da07f7e2efd01d4ea (patch) | |
tree | b3a2d0dc0edf781800b1b50c60e014dc32091d5c /libavcodec/wmaprodec.c | |
parent | afe03092dd693d025d43e1620283d8d285c92772 (diff) | |
download | ffmpeg-e30b068ef79f604ff439418da07f7e2efd01d4ea.tar.gz |
wmapro: make sure there is room to store the current packet
Prevent horrid and hard to trace struct overwrite.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Diffstat (limited to 'libavcodec/wmaprodec.c')
-rw-r--r-- | libavcodec/wmaprodec.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index 6a64641c87..8fdfbf866f 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -1459,6 +1459,14 @@ static void save_bits(WMAProDecodeCtx *s, GetBitContext* gb, int len, return; } + if (len > put_bits_left(&s->pb)) { + av_log(s->avctx, AV_LOG_ERROR, + "Cannot append %d bits, only %d bits available.\n", + len, put_bits_left(&s->pb)); + s->packet_loss = 1; + return; + } + s->num_saved_bits += len; if (!append) { avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), |