aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-10-14 23:17:51 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-31 19:51:56 +0100
commitc609312a4776edd88e9a2edfb8ab78b72d00a6d3 (patch)
tree0364993f57d74c9f62f7b427371b8a5b4e2d7f62
parent1c1b94aaae0e3ac5175244401997f44e01724c85 (diff)
downloadffmpeg-c609312a4776edd88e9a2edfb8ab78b72d00a6d3.tar.gz
avformat/vividas: Fix n_sb_blocks Check
Fixes: signed integer overflow: 1540265776 * 2 cannot be represented in type 'int' Fixes: 18160/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5758808818712576 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 114ddf64300fa78663ef35decbee89b5492abb1d) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/vividas.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/vividas.c b/libavformat/vividas.c
index efe1b8deff..ab3947815a 100644
--- a/libavformat/vividas.c
+++ b/libavformat/vividas.c
@@ -438,7 +438,7 @@ static int track_index(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *bu
ffio_read_varlen(pb); // track_index_len
avio_r8(pb); // 'c'
viv->n_sb_blocks = ffio_read_varlen(pb);
- if (viv->n_sb_blocks * 2 > size)
+ if (viv->n_sb_blocks < 0 || viv->n_sb_blocks > size / 2)
goto error;
viv->sb_blocks = av_calloc(viv->n_sb_blocks, sizeof(VIV_SB_block));
if (!viv->sb_blocks) {