diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-06-17 21:26:45 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-01 12:11:55 +0200 |
commit | 758f16b475edbd404071bf57585d864b2b63579c (patch) | |
tree | d271ef840add045d323a3ee65e18f0b84d62dc3f /libavcodec/libvorbisdec.c | |
parent | e6641846b02c51b84f4b83dc6702e36c495fd9d0 (diff) | |
download | ffmpeg-758f16b475edbd404071bf57585d864b2b63579c.tar.gz |
avcodec/libvorbisdec: Check extradata size
Fixes: out of array read
Fixes: 15261/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBVORBIS_fuzzer-5764908467093504
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 cf3c245566e8a8d45ed2ad9fdff9ef50327ba2d3)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/libvorbisdec.c')
-rw-r--r-- | libavcodec/libvorbisdec.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/libvorbisdec.c b/libavcodec/libvorbisdec.c index ecf690a553..89cbbb41b6 100644 --- a/libavcodec/libvorbisdec.c +++ b/libavcodec/libvorbisdec.c @@ -49,8 +49,16 @@ static int oggvorbis_decode_init(AVCodecContext *avccontext) { vorbis_comment_init(&context->vc) ; if(p[0] == 0 && p[1] == 30) { + int sizesum = 0; for(i = 0; i < 3; i++){ hsizes[i] = bytestream_get_be16((const uint8_t **)&p); + sizesum += 2 + hsizes[i]; + if (sizesum > avccontext->extradata_size) { + av_log(avccontext, AV_LOG_ERROR, "vorbis extradata too small\n"); + ret = AVERROR_INVALIDDATA; + goto error; + } + headers[i] = p; p += hsizes[i]; } |