Avoid undefined shifts in calculateSbrEnvelope

Fixes: 26845/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBFDK_AAC_fuzzer-5670674796118016

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
This commit is contained in:
Martin Storsjo 2020-11-17 12:18:36 +02:00
parent 4e944af756
commit d23a21ab42
1 changed files with 3 additions and 1 deletions

View File

@ -1477,8 +1477,10 @@ void calculateSbrEnvelope(
for (k = 0; k < noSubbands; k++) { for (k = 0; k < noSubbands; k++) {
int sc = scale_change - pNrgs->nrgGain_e[k] + (sc_change - 1); int sc = scale_change - pNrgs->nrgGain_e[k] + (sc_change - 1);
pNrgs->nrgGain[k] >>= sc;
pNrgs->nrgGain_e[k] += sc; pNrgs->nrgGain_e[k] += sc;
if (sc > 31)
sc = 31;
pNrgs->nrgGain[k] >>= sc;
} }
if (!useLP) { if (!useLP) {