aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Converse <alex.converse@gmail.com>2012-01-27 14:24:07 -0800
committerReinhard Tartler <siretart@tauware.de>2012-03-04 12:26:06 +0100
commitfecd7468fcbf9115afdd8bf3dc3d08da0975e4d8 (patch)
tree34fa62d4491b4c518f7c5f75d42f556384fd064c
parent19da1a39e861968c27504b67d481d32339669e2a (diff)
downloadffmpeg-fecd7468fcbf9115afdd8bf3dc3d08da0975e4d8.tar.gz
wmadec: Verify bitstream size makes sense before calling init_get_bits.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind (cherry picked from commit 48f1e5212c90b511c90fa0449655abb06a9edda2) Signed-off-by: Reinhard Tartler <siretart@tauware.de>
-rw-r--r--libavcodec/wmadec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index afc0658eac..b9fc21fd3e 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -877,6 +877,8 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
/* 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)