diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-08-21 23:05:21 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-09-04 20:26:35 +0200 |
commit | da3e2efad6dc17793f49d08d102663228df63a69 (patch) | |
tree | 6aeffaf092eb9e58800508d11de5852fe2fb823d /libavformat | |
parent | 61268f24540a54e7ffe134aad9e46e00bb862789 (diff) | |
download | ffmpeg-da3e2efad6dc17793f49d08d102663228df63a69.tar.gz |
avformat/vividas: Check av_xiphlacing() return value before use
Fixes: out of array access
Fixes: 16277/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5696629440512000
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 5937f0550304e39be64ce41cc936634f1db54e5d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/vividas.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libavformat/vividas.c b/libavformat/vividas.c index 0c33ca2da8..645e322b6e 100644 --- a/libavformat/vividas.c +++ b/libavformat/vividas.c @@ -392,8 +392,14 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t * p = st->codecpar->extradata; p[0] = 2; - for (j = 0; j < num_data - 1; j++) - offset += av_xiphlacing(&p[offset], data_len[j]); + for (j = 0; j < num_data - 1; j++) { + unsigned delta = av_xiphlacing(&p[offset], data_len[j]); + if (delta > data_len[j]) { + av_free(pb); + return AVERROR_INVALIDDATA; + } + offset += delta; + } for (j = 0; j < num_data; j++) { int ret = avio_read(pb, &p[offset], data_len[j]); |