diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-09-29 01:22:37 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-01-06 11:30:43 +0100 |
commit | 3088c82476a6686b32d43e855d22a388724d7f23 (patch) | |
tree | b443b4bf38c7ca12e62d4d526279ef8a1a0e8bb9 /libavcodec | |
parent | 25a7110651ee6c9913b027fe5460918bf8e3dbea (diff) | |
download | ffmpeg-3088c82476a6686b32d43e855d22a388724d7f23.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>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/pcm.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index ffcbccc77d..4112b694df 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -264,6 +264,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) |