aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-02-20 05:48:54 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-02-23 16:36:01 +0100
commitea7ccf3748452b614b6ae81fa814303a49733fc2 (patch)
treedac27afebdb3f506e9081df911eea5f58dec9b21
parent846a9c67ff6ea022a66c3a65789a1ceb367917ba (diff)
downloadffmpeg-ea7ccf3748452b614b6ae81fa814303a49733fc2.tar.gz
avcodec/mpeg4videodec: Check for bitstream overread in decode_vol_header()
Fixes out of array read Fixes: 08e48e9daae7d8f8ab6dbe3919e797e5-asan_heap-oob_157461c_5295_cov_1266798650_firefing.mpg Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 3edc3b159503d512c919b3d5902f7026e961823a) Conflicts: libavcodec/mpeg4videodec.c
-rw-r--r--libavcodec/mpeg4videodec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index dd97bd791b..7a4a441100 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -1766,6 +1766,11 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
s->quarter_sample= get_bits1(gb);
else s->quarter_sample=0;
+ if (get_bits_left(gb) < 4) {
+ av_log(s->avctx, AV_LOG_ERROR, "VOL Header truncated\n");
+ return AVERROR_INVALIDDATA;
+ }
+
if(!get_bits1(gb)){
int pos= get_bits_count(gb);
int estimation_method= get_bits(gb, 2);