summaryrefslogtreecommitdiff
path: root/libavformat/thp.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-05-31 14:24:04 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-03 12:10:24 +0200
commitbe9e89efcde74635e120505c7f1bd0071e292011 (patch)
tree8b19ad80de2052796e080c2e012397ecf1985fe6 /libavformat/thp.c
parentdd6147888c5e17d54c018706a04fad7c4206f7bf (diff)
downloadffmpeg-be9e89efcde74635e120505c7f1bd0071e292011.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>
Diffstat (limited to 'libavformat/thp.c')
-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);