aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-05-31 14:24:04 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-02 19:55:09 +0200
commitd46f466bb7041de84834aac5f1cb210ca3abd1b8 (patch)
tree5bed732ff7f393b2d3b51d3141dee9c75f9a54a9
parent33b0592bfe3b74136285eab01b07be6c05bc0036 (diff)
downloadffmpeg-d46f466bb7041de84834aac5f1cb210ca3abd1b8.tar.gz
avformat/thp: Check compcount
Fixes: out of array access Fixes: 22520/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5100297658826752 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 1ba8484559661dfdbca36dbc17b203f33f62e26c) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/thp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/thp.c b/libavformat/thp.c
index 38db4da89a..249c767b20 100644
--- a/libavformat/thp.c
+++ b/libavformat/thp.c
@@ -93,6 +93,9 @@ static int thp_read_header(AVFormatContext *s)
avio_seek (pb, thp->compoff, SEEK_SET);
thp->compcount = avio_rb32(pb);
+ if (thp->compcount > FF_ARRAY_ELEMS(thp->components))
+ return AVERROR_INVALIDDATA;
+
/* Read the list of component types. */
avio_read(pb, thp->components, 16);