avformat/mpc8: Check remaining space in mpc8_parse_seektable()

Fixes: Fixes infinite loop
Fixes: 26704/clusterfuzz-testcase-minimized-ffmpeg_dem_MPC8_fuzzer-6327056939614208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4f66dd13d0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-10-30 21:50:32 +01:00
parent 1e4a9d64d1
commit 6eba6551b8
1 changed files with 4 additions and 0 deletions

View File

@ -177,6 +177,10 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
av_add_index_entry(s->streams[0], pos, i, 0, 0, AVINDEX_KEYFRAME);
}
for(; i < size; i++){
if (get_bits_left(&gb) < 13) {
av_free(buf);
return;
}
t = get_unary(&gb, 1, 33) << 12;
t += get_bits(&gb, 12);
if(t & 1)