aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec/src/stereo.cpp
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2019-08-09 17:10:07 +0200
committerJean-Michel Trivi <jmtrivi@google.com>2019-10-14 15:14:28 -0700
commit15965e3feb9025e1db65a7c9a7408b3970430cb8 (patch)
tree56ec079952c14851aa5196e537fc7e5605ea21f5 /libAACdec/src/stereo.cpp
parent6f98eab35095f5fd7bcfb9df585ff0b0c6f1460d (diff)
downloadfdk-aac-15965e3feb9025e1db65a7c9a7408b3970430cb8.tar.gz
fdk-aac-15965e3feb9025e1db65a7c9a7408b3970430cb8.tar.bz2
fdk-aac-15965e3feb9025e1db65a7c9a7408b3970430cb8.zip
Limit too large shift exponent in CJointStereo_ApplyMS()
Bug: 131430997 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: Ia6ab654654e899368ba207a66eddf22b6b855635
Diffstat (limited to 'libAACdec/src/stereo.cpp')
-rw-r--r--libAACdec/src/stereo.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/libAACdec/src/stereo.cpp b/libAACdec/src/stereo.cpp
index eed826b..a90ae35 100644
--- a/libAACdec/src/stereo.cpp
+++ b/libAACdec/src/stereo.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -807,19 +807,17 @@ void CJointStereo_ApplyMS(
for (int i = 0; i < windowLen; i++) {
dmx_re_prev[i] =
((staticSpectralCoeffsL[index_offset + i] >>
- srLeftChan) +
+ fMin(DFRACT_BITS - 1, srLeftChan + 1)) +
(staticSpectralCoeffsR[index_offset + i] >>
- srRightChan)) >>
- 1;
+ fMin(DFRACT_BITS - 1, srRightChan + 1)));
}
} else {
for (int i = 0; i < windowLen; i++) {
dmx_re_prev[i] =
((staticSpectralCoeffsL[index_offset + i] >>
- srLeftChan) -
+ fMin(DFRACT_BITS - 1, srLeftChan + 1)) -
(staticSpectralCoeffsR[index_offset + i] >>
- srRightChan)) >>
- 1;
+ fMin(DFRACT_BITS - 1, srRightChan + 1)));
}
}
}
@@ -854,12 +852,13 @@ void CJointStereo_ApplyMS(
if (window == 0) {
if (dmx_re_prev_e < frameMaxScale) {
if (mainband_flag == 0) {
- scaleValues(dmx_re_prev, store_dmx_re_prev, windowLen,
- -(frameMaxScale - dmx_re_prev_e));
+ scaleValues(
+ dmx_re_prev, store_dmx_re_prev, windowLen,
+ -fMin(DFRACT_BITS - 1, (frameMaxScale - dmx_re_prev_e)));
} else {
- for (int i = 0; i < windowLen; i++) {
- dmx_re_prev[i] >>= (frameMaxScale - dmx_re_prev_e);
- }
+ scaleValues(
+ dmx_re_prev, windowLen,
+ -fMin(DFRACT_BITS - 1, (frameMaxScale - dmx_re_prev_e)));
}
} else {
if (mainband_flag == 0) {
@@ -873,10 +872,9 @@ void CJointStereo_ApplyMS(
FDK_ASSERT(pAacDecoderChannelInfo[L]->icsInfo.WindowSequence ==
BLOCK_SHORT);
if (specScaleL[window - 1] < frameMaxScale) {
- for (int i = 0; i < windowLen; i++) {
- dmx_re[windowLen * (window - 1) + i] >>=
- (frameMaxScale - specScaleL[window - 1]);
- }
+ scaleValues(&dmx_re[windowLen * (window - 1)], windowLen,
+ -fMin(DFRACT_BITS - 1,
+ (frameMaxScale - specScaleL[window - 1])));
} else {
specScaleL[window] = specScaleL[window - 1];
specScaleR[window] = specScaleR[window - 1];