aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-29 01:22:37 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-15 12:25:46 +0100
commit5577079473003d0bc1e283197fd6f852b5491bce (patch)
tree3f13620b78ce6a6d8e96dd643be2872aa2ae82c9
parentd109b2d41dfd552ef210bbd72eadfcad154f7b2b (diff)
downloadffmpeg-5577079473003d0bc1e283197fd6f852b5491bce.tar.gz
avcodec/pcm: Check bits_per_coded_sample
Fixes: shift exponent -2 is negative Fixes: 17736/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PCM_F16LE_fuzzer-5742815929171968 Fixes: 17998/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PCM_F24LE_fuzzer-5716980383875072 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 5de19160a3c0dedb3cefd00e863a8d8f74ca2ad0) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/pcm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 8c326c6829..c52ebcd0d6 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -251,6 +251,9 @@ static av_cold int pcm_decode_init(AVCodecContext *avctx)
break;
case AV_CODEC_ID_PCM_F16LE:
case AV_CODEC_ID_PCM_F24LE:
+ if (avctx->bits_per_coded_sample < 1 || avctx->bits_per_coded_sample > 24)
+ return AVERROR_INVALIDDATA;
+
s->scale = 1. / (1 << (avctx->bits_per_coded_sample - 1));
s->fdsp = avpriv_float_dsp_alloc(0);
if (!s->fdsp)