avcodec/ituh263dec: Avoid spending a long time in slice sync

Fixes: 177/fuzz-3-ffmpeg_VIDEO_AV_CODEC_ID_FLV1_fuzzer

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2baf36caed)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2016-11-15 18:05:33 +01:00
parent 24195619f6
commit 32c51deb3c
1 changed files with 1 additions and 0 deletions

View File

@ -163,6 +163,7 @@ static int h263_decode_gob_header(MpegEncContext *s)
/* We have a GBSC probably with GSTUFF */ /* We have a GBSC probably with GSTUFF */
skip_bits(&s->gb, 16); /* Drop the zeros */ skip_bits(&s->gb, 16); /* Drop the zeros */
left= get_bits_left(&s->gb); left= get_bits_left(&s->gb);
left = FFMIN(left, 32);
//MN: we must check the bits left or we might end in a infinite loop (or segfault) //MN: we must check the bits left or we might end in a infinite loop (or segfault)
for(;left>13; left--){ for(;left>13; left--){
if(get_bits1(&s->gb)) break; /* Seek the '1' bit */ if(get_bits1(&s->gb)) break; /* Seek the '1' bit */