aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2020-06-22 13:27:41 +0300
committerMartin Storsjo <martin@martin.st>2020-06-22 13:28:10 +0300
commitec58a940e2b6f9514d34973dcdaa18730394309a (patch)
treef6961360449446e122e02f52383d7d2d650338ec
parent845febbb4aa8b81914a8d759536ec48f496d46a3 (diff)
downloadfdk-aac-ec58a940e2b6f9514d34973dcdaa18730394309a.tar.gz
fdk-aac-ec58a940e2b6f9514d34973dcdaa18730394309a.tar.bz2
fdk-aac-ec58a940e2b6f9514d34973dcdaa18730394309a.zip
Avoid undefined shifts
Fixes: 23522/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBFDK_AAC_fuzzer-5468272958111744 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
-rw-r--r--libAACdec/src/aacdec_hcr.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/libAACdec/src/aacdec_hcr.cpp b/libAACdec/src/aacdec_hcr.cpp
index 6114756..26fdd97 100644
--- a/libAACdec/src/aacdec_hcr.cpp
+++ b/libAACdec/src/aacdec_hcr.cpp
@@ -1423,6 +1423,9 @@ static INT DecodeEscapeSequence(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor,
sign = (quantSpecCoef >= 0) ? 1 : -1;
+ if (escapeOnesCounter > 30)
+ escapeOnesCounter = 30;
+
quantSpecCoef = sign * (((INT)1 << escapeOnesCounter) + escape_word);
return quantSpecCoef;