Commit f2a9a30f authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/adpcm: Fix adpcm_ima_wav padding

Fixes out of array read
Fixes: f29f134ea5f5590df554a7733294a587/asan_stack-oob_309d14e_9188_ea01743d6355aff20530f3d4cdaa841a.wav

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 26246954
...@@ -803,7 +803,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, ...@@ -803,7 +803,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
if (avctx->bits_per_coded_sample != 4) { if (avctx->bits_per_coded_sample != 4) {
int samples_per_block = ff_adpcm_ima_block_samples[avctx->bits_per_coded_sample - 2]; int samples_per_block = ff_adpcm_ima_block_samples[avctx->bits_per_coded_sample - 2];
int block_size = ff_adpcm_ima_block_sizes[avctx->bits_per_coded_sample - 2]; int block_size = ff_adpcm_ima_block_sizes[avctx->bits_per_coded_sample - 2];
uint8_t temp[20] = { 0 }; uint8_t temp[20 + AV_INPUT_BUFFER_PADDING_SIZE] = { 0 };
GetBitContext g; GetBitContext g;
for (n = 0; n < (nb_samples - 1) / samples_per_block; n++) { for (n = 0; n < (nb_samples - 1) / samples_per_block; n++) {
......
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