summaryrefslogtreecommitdiff
path: root/libavformat/wtvdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-03-04 00:30:45 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:53:29 +0200
commit4779c0ea924e13f66558d02eb42e9f645ac476ab (patch)
tree2f327fcbe71850f9cf61ef68090fec7c7580b96f /libavformat/wtvdec.c
parent0a8717e4b3a2b545a58b69ece8c097277b6eaf26 (diff)
downloadffmpeg-4779c0ea924e13f66558d02eb42e9f645ac476ab.tar.gz
avformat/wtvdec: Check size in SBE2_STREAM_DESC_EVENT / stream2_guid
Fixes: signed integer overflow: 539033600 - -1910497124 cannot be represented in type 'int' Fixes: 30928/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-5922630966312960 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 1f74661543c0c336e88846f90608fda7bd12deac) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/wtvdec.c')
-rw-r--r--libavformat/wtvdec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index 6f4d266992..babe49dcac 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -818,6 +818,8 @@ 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)
+ return AVERROR_INVALIDDATA;
parse_media_type(s, 0, sid, mediatype, subtype, formattype, size);
consumed += 92 + size;
}
@@ -832,6 +834,8 @@ 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)
+ return AVERROR_INVALIDDATA;
parse_media_type(s, s->streams[stream_index], sid, mediatype, subtype, formattype, size);
consumed += 76 + size;
}