mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
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>
This commit is contained in:
parent
7c30ff3888
commit
cf3c245566
@ -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];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user