aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-10-02 19:26:51 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-11 20:18:47 +0100
commit2f20bd7076e9fbbcca77991b925598a5d045032f (patch)
treebb42b88fe53e9537f05b21218d4a0c7a4137ab67
parentfe82ca8709aa633b948b8be2afd5a396c7cfbcde (diff)
downloadffmpeg-2f20bd7076e9fbbcca77991b925598a5d045032f.tar.gz
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 9b533de28eb19c660c75823ff2af2f8549c4095a) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/wmaprodec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 9439bfa771..7af53dd02c 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1874,7 +1874,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;
}