diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-04-24 18:42:19 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-10-06 14:54:16 +0300 |
commit | e9f7f01b769d44f34703d40f47c38754ba4ed511 (patch) | |
tree | e50dfc0eb9261c7d01b747f91f507b18fb9ad558 | |
parent | 92214f9c1d5a1a842c994dda23549d6c49b1bae8 (diff) |
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>
(cherry picked from commit 8ef25d118246bf443900033fb3588dba628d11b0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/mpc8.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index eed537c5a6..db5f7f210d 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -200,8 +200,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; |