Commit ac73879f authored by Michael Niedermayer's avatar Michael Niedermayer

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/ffmpegReviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 5603176a
...@@ -154,9 +154,9 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx) ...@@ -154,9 +154,9 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
case AV_CODEC_ID_ADPCM_IMA_APM: case AV_CODEC_ID_ADPCM_IMA_APM:
if (avctx->extradata && avctx->extradata_size >= 16) { if (avctx->extradata && avctx->extradata_size >= 16) {
c->status[0].predictor = AV_RL32(avctx->extradata + 0); 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].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; break;
case AV_CODEC_ID_ADPCM_IMA_WS: case AV_CODEC_ID_ADPCM_IMA_WS:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment