aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-04-23 17:35:20 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-06 14:41:41 +0200
commitda825c61f434ad9ce3e749579f53ec96f1832a40 (patch)
tree371b24f21f9a49a5031fd617b96fd69a7e23a7ca /libavformat
parentd84c0fa6f9a87f62170cd873f05b918cf0829621 (diff)
downloadffmpeg-da825c61f434ad9ce3e749579f53ec96f1832a40.tar.gz
avformat/asfdec_f: Check sizeX against padding
Fixes: signed integer overflow: 2147483607 + 64 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_fuzzer-6753897878257664 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 f034c2e36acb7d0c11dc1849ddf8a67bde44eff4) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/asfdec_f.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index 0aab7c2300..ca360363a6 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -516,7 +516,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
tag1 = avio_rl32(pb);
avio_skip(pb, 20);
if (sizeX > 40) {
- if (size < sizeX - 40)
+ if (size < sizeX - 40 || sizeX - 40 > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
return AVERROR_INVALIDDATA;
st->codecpar->extradata_size = ffio_limit(pb, sizeX - 40);
st->codecpar->extradata = av_mallocz(st->codecpar->extradata_size +