diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2013-06-28 04:03:47 +0200 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2013-07-06 10:06:11 +0200 |
commit | 4ff5167ee7fdee6d35c1bb2558172329ae6ec770 (patch) | |
tree | fc46915adaa8f72c8661aa5bef5ba70e2af9eef8 | |
parent | b20004b2e6165a6d5ef6bc6ae98d3d33c6460808 (diff) | |
download | ffmpeg-4ff5167ee7fdee6d35c1bb2558172329ae6ec770.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
(cherry picked from commit e30b068ef79f604ff439418da07f7e2efd01d4ea)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
-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 1b7797c9f2..cc8df9b900 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -1466,6 +1466,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), |