diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-07-20 22:41:08 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-08-03 17:44:23 +0200 |
commit | 07357cd93355d553dde698933a8176dd48b98344 (patch) | |
tree | 8cfb44ec9cd26fc57f03230f9124cc54fa42945b | |
parent | 8bac648359b78cd4aa02b5fc91c24a32cc3bddfa (diff) | |
download | ffmpeg-07357cd93355d553dde698933a8176dd48b98344.tar.gz |
avformat/vividas: Check that value from ffio_read_varlen() does not overflow
Fixes: signed integer overflow: -1241665686 + -1340629419 cannot be represented in type 'int'
Fixes: 15922/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5692826442006528
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/vividas.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/vividas.c b/libavformat/vividas.c index 1895c75858..c3d3cf548c 100644 --- a/libavformat/vividas.c +++ b/libavformat/vividas.c @@ -374,8 +374,11 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t * ffio_read_varlen(pb); // len_3 num_data = avio_r8(pb); for (j = 0; j < num_data; j++) { - data_len[j] = ffio_read_varlen(pb); - xd_size += data_len[j]; + uint64_t len = ffio_read_varlen(pb); + if (len > INT_MAX/2 - xd_size) + return AVERROR_INVALIDDATA; + data_len[j] = len; + xd_size += len; } st->codecpar->extradata_size = 64 + xd_size + xd_size / 255; |