aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-11-21 23:02:56 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 12:49:26 +0200
commit5251e09f2aa41c7eb7d48c5850ecc070e8c70562 (patch)
treea6269d3c20f48999c9fd7f4087bcad1983bb80d0
parent096b57c93bbae7402286f00232db782d4d4e4b8d (diff)
downloadffmpeg-5251e09f2aa41c7eb7d48c5850ecc070e8c70562.tar.gz
avcodec/adpcm: Clip predictor for APC
Fixes: signed integer overflow: -2147483648 - 13 cannot be represented in type 'int' Fixes: 18893/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_APC_fuzzer-5630760442920960 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 9fe07908c3f67d59cf4db5668d61b34506189590) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/adpcm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index df31bc1e0c..5bee48171a 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -139,8 +139,8 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
break;
case AV_CODEC_ID_ADPCM_IMA_APC:
if (avctx->extradata && avctx->extradata_size >= 8) {
- c->status[0].predictor = AV_RL32(avctx->extradata);
- c->status[1].predictor = AV_RL32(avctx->extradata + 4);
+ c->status[0].predictor = av_clip_intp2(AV_RL32(avctx->extradata ), 18);
+ c->status[1].predictor = av_clip_intp2(AV_RL32(avctx->extradata + 4), 18);
}
break;
case AV_CODEC_ID_ADPCM_IMA_WS: