diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-04-19 20:23:41 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-09-09 13:54:52 +0200 |
commit | 06342bca35e7963c03414ddd8e1670566eecfc0e (patch) | |
tree | cc2a0e54bba202584617446337820bdd9bcd2615 /libavformat/wtvdec.c | |
parent | b655cebd913d24a9e304f843103268eba2c4ce99 (diff) | |
download | ffmpeg-06342bca35e7963c03414ddd8e1670566eecfc0e.tar.gz |
avformat/wtvdec: Improve size overflow checks in parse_chunks()
Fixes: signed integer overflow: 32 + 2147483647 cannot be represented in type 'int
Fixes: 32967/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-5132856218222592
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f8ec1da8ac8e3daf2403e744f166ea9557b2d333)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/wtvdec.c')
-rw-r--r-- | libavformat/wtvdec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index babe49dcac..9ec20c1d37 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -818,7 +818,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p avio_skip(pb, 12); ff_get_guid(pb, &formattype); size = avio_rl32(pb); - if (size < 0 || size > INT_MAX - 92) + if (size < 0 || size > INT_MAX - 92 - consumed) return AVERROR_INVALIDDATA; parse_media_type(s, 0, sid, mediatype, subtype, formattype, size); consumed += 92 + size; @@ -834,7 +834,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p avio_skip(pb, 12); ff_get_guid(pb, &formattype); size = avio_rl32(pb); - if (size < 0 || size > INT_MAX - 76) + if (size < 0 || size > INT_MAX - 76 - consumed) return AVERROR_INVALIDDATA; parse_media_type(s, s->streams[stream_index], sid, mediatype, subtype, formattype, size); consumed += 76 + size; |