diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-03-01 22:30:00 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-03-02 23:39:06 +0100 |
commit | ac73879f1bb27aa979a69bda24d1ca790e69f341 (patch) | |
tree | 480f282fb7ba4d3a9823c8c52d4aed8736beb89b | |
parent | 5603176ab4aaf811cac67420f234b3778e887278 (diff) | |
download | ffmpeg-ac73879f1bb27aa979a69bda24d1ca790e69f341.tar.gz |
avcodec/adpcm: Clip step index for ADPCM_IMA_APM
Fixes: out of array access
Fixes: 20828/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_APM_fuzzer-5712770106654720
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>
-rw-r--r-- | libavcodec/adpcm.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index b987e93c5f..5f152ee6ef 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -154,9 +154,9 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx) case AV_CODEC_ID_ADPCM_IMA_APM: if (avctx->extradata && avctx->extradata_size >= 16) { c->status[0].predictor = AV_RL32(avctx->extradata + 0); - c->status[0].step_index = AV_RL32(avctx->extradata + 4); + c->status[0].step_index = av_clip(AV_RL32(avctx->extradata + 4), 0, 88); c->status[1].predictor = AV_RL32(avctx->extradata + 8); - c->status[1].step_index = AV_RL32(avctx->extradata + 12); + c->status[1].step_index = av_clip(AV_RL32(avctx->extradata + 12), 0, 88); } break; case AV_CODEC_ID_ADPCM_IMA_WS: |