aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-08-20 16:52:07 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-02 20:58:37 +0100
commit59f2ec706267a0fb65151a10fd9526be91a2f72c (patch)
treee1552b45d9f36efeab8108abd64805506dc1dd69
parent1b0aac8f428289b57f8805ab08aeab5d71ff09f5 (diff)
downloadffmpeg-59f2ec706267a0fb65151a10fd9526be91a2f72c.tar.gz
avcodec/alsdec: Limit maximum channels to 512
There seems to be no limit in the specification and upto 64k could be stored 512 is choosen as limit as thats the maximum in a conformance sample An alternative to this patch would be a max_channels variable Fixes: OOM Fixes: 16200/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5764788793114624 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Suggested-by: Thilo Borgmann <thilo.borgmann@mail.de> Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit f51e4d026cc762ff2d47d6107658dbff42ba5ea8) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/alsdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 8bef22dc48..534b2906b3 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -337,6 +337,11 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
if (als_id != MKBETAG('A','L','S','\0'))
return AVERROR_INVALIDDATA;
+ if (avctx->channels > FF_SANE_NB_CHANNELS) {
+ avpriv_request_sample(avctx, "Huge number of channels\n");
+ return AVERROR_PATCHWELCOME;
+ }
+
ctx->cur_frame_length = sconf->frame_length;
// read channel config