Browse Source

avcodec/wmaprodec: Check if there is a stream

Fixes: null pointer dereference
Fixes: signed integer overflow: 512 * 2147483647 cannot be represented in type 'int'
Fixes: 17809/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA1_fuzzer-5634409947987968

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 9b533de28e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n4.2.2
Michael Niedermayer 6 years ago
parent
commit
9cb50bb3cc
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      libavcodec/wmaprodec.c

+ 3
- 1
libavcodec/wmaprodec.c View File

@@ -1902,7 +1902,9 @@ static av_cold int xma_decode_init(AVCodecContext *avctx)
}

/* encoder supports up to 64 streams / 64*2 channels (would have to alloc arrays) */
if (avctx->channels > XMA_MAX_CHANNELS || s->num_streams > XMA_MAX_STREAMS) {
if (avctx->channels > XMA_MAX_CHANNELS || s->num_streams > XMA_MAX_STREAMS ||
s->num_streams <= 0
) {
avpriv_request_sample(avctx, "More than %d channels in %d streams", XMA_MAX_CHANNELS, s->num_streams);
return AVERROR_PATCHWELCOME;
}


Loading…
Cancel
Save