aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2018-12-28 15:23:41 -0800
committerandroid-build-merger <android-build-merger@google.com>2018-12-28 15:23:41 -0800
commit762902309ecfccf5c59ee14f2a63234f4db5ff4d (patch)
tree3e6f9e1c279d9ef0e1c6df528cc44884dcfa5c08
parenta228b624b52bda9d05add8369d48211112379809 (diff)
parent0cd0a834f6b72e6c8d071a31496681dac4c93422 (diff)
downloadfdk-aac-762902309ecfccf5c59ee14f2a63234f4db5ff4d.tar.gz
fdk-aac-762902309ecfccf5c59ee14f2a63234f4db5ff4d.tar.bz2
fdk-aac-762902309ecfccf5c59ee14f2a63234f4db5ff4d.zip
Merge "Fix potential invalid memory access for concealment in decodeEnvelope()" am: 6acfe3b799 am: 3d9793633e
am: 0cd0a834f6 Change-Id: Ibb76aaeeb9c8d3c844d41d9b60ce2949017af774
-rw-r--r--libSBRdec/src/env_dec.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/libSBRdec/src/env_dec.cpp b/libSBRdec/src/env_dec.cpp
index 05accd1..95807c9 100644
--- a/libSBRdec/src/env_dec.cpp
+++ b/libSBRdec/src/env_dec.cpp
@@ -506,15 +506,20 @@ static void decodeEnvelope(
*/
for (i = 0; i < hHeaderData->freqBandData.nSfb[1]; i++) {
/* Former Level-Channel will be used for both channels */
- if (h_prev_data->coupling == COUPLING_BAL)
- h_prev_data->sfb_nrg_prev[i] = otherChannel->sfb_nrg_prev[i];
+ if (h_prev_data->coupling == COUPLING_BAL) {
+ h_prev_data->sfb_nrg_prev[i] =
+ (otherChannel != NULL) ? otherChannel->sfb_nrg_prev[i]
+ : (FIXP_SGL)SBR_ENERGY_PAN_OFFSET;
+ }
/* Former L/R will be combined as the new Level-Channel */
- else if (h_sbr_data->coupling == COUPLING_LEVEL)
+ else if (h_sbr_data->coupling == COUPLING_LEVEL &&
+ otherChannel != NULL) {
h_prev_data->sfb_nrg_prev[i] = (h_prev_data->sfb_nrg_prev[i] +
otherChannel->sfb_nrg_prev[i]) >>
1;
- else if (h_sbr_data->coupling == COUPLING_BAL)
+ } else if (h_sbr_data->coupling == COUPLING_BAL) {
h_prev_data->sfb_nrg_prev[i] = (FIXP_SGL)SBR_ENERGY_PAN_OFFSET;
+ }
}
}
}