aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-21 23:05:41 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-02-02 14:18:21 +0100
commitbd79a4e0ecb11a86e090316cd7a5724ebea1c658 (patch)
tree9e1fe5a8faab4abba756afcadc788fe1a91ce00e
parentcd733f1c88982d870b647cca480131fcb406e090 (diff)
downloadffmpeg-bd79a4e0ecb11a86e090316cd7a5724ebea1c658.tar.gz
avformat/vividas: better check of current_sb_entry
This is the simplest fix for the problem, it is possible to instead check this when the variables are set and propagate errors and then fail earlier Fixes: out of array access Fixes: 26490/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5723367078100992 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 b848baef0dc42d97a5c1ab975cc8994a265b88ae) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/vividas.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/vividas.c b/libavformat/vividas.c
index f5629f7eb4..d38bb8d84b 100644
--- a/libavformat/vividas.c
+++ b/libavformat/vividas.c
@@ -671,6 +671,10 @@ static int viv_read_packet(AVFormatContext *s,
if (!pb)
return AVERROR(EIO);
off = avio_tell(pb);
+
+ if (viv->current_sb_entry >= viv->n_sb_entries)
+ return AVERROR_INVALIDDATA;
+
off += viv->sb_entries[viv->current_sb_entry].size;
if (viv->sb_entries[viv->current_sb_entry].flag == 0) {