[FFmpeg-cvslog] avformat/asfdec_f: Add an additional check for the extradata size

Michael Niedermayer git at videolan.org
Sat Feb 20 22:10:30 EET 2021


ffmpeg | branch: release/4.3 | Michael Niedermayer <michael at niedermayer.cc> | Sun Feb  7 21:50:03 2021 +0100| [a5f1321f81c9940007c3be974c927302ad416090] | committer: Michael Niedermayer

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 at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 2c8cd4490a6ab2742e6ad1ce059b4f4957b39500)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a5f1321f81c9940007c3be974c927302ad416090
---

 libavformat/asfdec_f.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index 5b4119a315..0aab7c2300 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);



More information about the ffmpeg-cvslog mailing list