aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/adpcm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-05-31 14:59:02 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-02 19:55:09 +0200
commit33b0592bfe3b74136285eab01b07be6c05bc0036 (patch)
tree35d5d70fece4f86dcdb9da153930c29724300da0 /libavcodec/adpcm.c
parent2f51ee968cd821ee170b59333366cbcf2d28241a (diff)
downloadffmpeg-33b0592bfe3b74136285eab01b07be6c05bc0036.tar.gz
avcodec/adpcm: XA: Check shift similar to filter
Fixes: negative shift Fixes: 22499/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_XA_fuzzer-5765452130418688 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 6d96bae9c480e020e9f51fabd5642d7ae6020943) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/adpcm.c')
-rw-r--r--libavcodec/adpcm.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 5c2e8c94e9..9c59e457c6 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -382,6 +382,10 @@ static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1,
avpriv_request_sample(avctx, "unknown XA-ADPCM filter %d", filter);
filter=0;
}
+ if (shift < 0) {
+ avpriv_request_sample(avctx, "unknown XA-ADPCM shift %d", shift);
+ shift = 0;
+ }
f0 = xa_adpcm_table[filter][0];
f1 = xa_adpcm_table[filter][1];
@@ -407,10 +411,14 @@ static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1,
shift = 12 - (in[5+i*2] & 15);
filter = in[5+i*2] >> 4;
- if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table)) {
+ if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table) || shift < 0) {
avpriv_request_sample(avctx, "unknown XA-ADPCM filter %d", filter);
filter=0;
}
+ if (shift < 0) {
+ avpriv_request_sample(avctx, "unknown XA-ADPCM shift %d", shift);
+ shift = 0;
+ }
f0 = xa_adpcm_table[filter][0];
f1 = xa_adpcm_table[filter][1];