Browse Source

avcodec/alsdec: Fix integer overflows of raw_samples in decode_var_block_data()

This also makes the code consistent with the existing similar MUL64()
in decode_var_block_data()

Fixes: signed integer overflow: -7277630735906765035 + -3272193951413647896 cannot be represented in type 'long'
Fixes: 16015/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5666552818434048

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 fad3ec89b7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n4.1.5
Michael Niedermayer 6 years ago
parent
commit
2dcf33b9a9
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      libavcodec/alsdec.c

+ 2
- 2
libavcodec/alsdec.c View File

@@ -918,7 +918,7 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
y = 1 << 6;

for (base = begin; base < end; base++, tab++)
y += MUL64(bd->ltp_gain[tab], raw_samples[base]);
y += (uint64_t)MUL64(bd->ltp_gain[tab], raw_samples[base]);

raw_samples[ltp_smp] += y >> 7;
}
@@ -930,7 +930,7 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
y = 1 << 19;

for (sb = 0; sb < smp; sb++)
y += MUL64(lpc_cof[sb], raw_samples[-(sb + 1)]);
y += (uint64_t)MUL64(lpc_cof[sb], raw_samples[-(sb + 1)]);

*raw_samples++ -= y >> 20;
parcor_to_lpc(smp, quant_cof, lpc_cof);


Loading…
Cancel
Save