1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avformat/mpc8: Check for position overflow in mpc8_handle_chunk()

Fixes: signed integer overflow: 15 + 9223372036854775796 cannot be represented in type 'long'
Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_MPC8_fuzzer-6723520756318208
Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_MPC8_fuzzer-6739833034768384

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2021-04-24 17:42:19 +02:00
parent ff05326081
commit 8ef25d1182

View File

@ -205,8 +205,11 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in
switch(tag){
case TAG_SEEKTBLOFF:
pos = avio_tell(pb) + size;
pos = avio_tell(pb);
off = ffio_read_varlen(pb);
if (pos > INT64_MAX - size || off < 0 || off > INT64_MAX - chunk_pos)
return;
pos += size;
mpc8_parse_seektable(s, chunk_pos + off);
avio_seek(pb, pos, SEEK_SET);
break;