aboutsummaryrefslogtreecommitdiffstats
path: root/libSBRdec/src/env_calc.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2020-11-17 12:18:36 +0200
committerMartin Storsjo <martin@martin.st>2020-11-17 12:26:19 +0200
commitd23a21ab427da642c8f32bb0659ae63a86f98e96 (patch)
tree36cf46ed27452b80a9ab4fbe0115439726ca70ab /libSBRdec/src/env_calc.cpp
parent4e944af756ec44e73b78bbed84a01fa9d2dfa5f5 (diff)
downloadfdk-aac-d23a21ab427da642c8f32bb0659ae63a86f98e96.tar.gz
fdk-aac-d23a21ab427da642c8f32bb0659ae63a86f98e96.tar.bz2
fdk-aac-d23a21ab427da642c8f32bb0659ae63a86f98e96.zip
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
Diffstat (limited to 'libSBRdec/src/env_calc.cpp')
-rw-r--r--libSBRdec/src/env_calc.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libSBRdec/src/env_calc.cpp b/libSBRdec/src/env_calc.cpp
index 1242833..2efff4f 100644
--- a/libSBRdec/src/env_calc.cpp
+++ b/libSBRdec/src/env_calc.cpp
@@ -1477,8 +1477,10 @@ void calculateSbrEnvelope(
for (k = 0; k < noSubbands; k++) {
int sc = scale_change - pNrgs->nrgGain_e[k] + (sc_change - 1);
- pNrgs->nrgGain[k] >>= sc;
pNrgs->nrgGain_e[k] += sc;
+ if (sc > 31)
+ sc = 31;
+ pNrgs->nrgGain[k] >>= sc;
}
if (!useLP) {