aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-02-07 21:50:03 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-10 16:04:26 +0200
commit5e0ef4e2a99ac9f473cd54d4ebe932f13e3bbe80 (patch)
treed5b71ee42b1bfcbd49bba7cb734d28a4b540f224
parentc8707132a90b1fdcb71aaefe5d01aaefaadcb8f9 (diff)
downloadffmpeg-5e0ef4e2a99ac9f473cd54d4ebe932f13e3bbe80.tar.gz
avformat/asfdec_f: Add an additional check for the extradata size
Fixes: OOM Fixes: 30066/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_fuzzer-6182309126602752 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 2c8cd4490a6ab2742e6ad1ce059b4f4957b39500) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/asfdec_f.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index e2d5220f46..775ef4067f 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -516,6 +516,8 @@ 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)
+ return AVERROR_INVALIDDATA;
st->codecpar->extradata_size = ffio_limit(pb, sizeX - 40);
st->codecpar->extradata = av_mallocz(st->codecpar->extradata_size +
AV_INPUT_BUFFER_PADDING_SIZE);