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 3edc3b1595
)
Conflicts:
libavcodec/mpeg4videodec.c
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user