aboutsummaryrefslogtreecommitdiffstats
path: root/libSBRdec/src/env_dec.cpp
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2018-12-28 23:03:46 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-12-28 23:03:46 +0000
commit6acfe3b799e0b030fb807e1a92a8b0a507b0207d (patch)
treefee49df3b7f4afa8ed11547c32a266ba9260392d /libSBRdec/src/env_dec.cpp
parentc19c36cbfc81c35d5c00d8e2b2a4f2456e278887 (diff)
parent82383e3212cb5ec84dd403a44ee4c01193961c8f (diff)
downloadfdk-aac-6acfe3b799e0b030fb807e1a92a8b0a507b0207d.tar.gz
fdk-aac-6acfe3b799e0b030fb807e1a92a8b0a507b0207d.tar.bz2
fdk-aac-6acfe3b799e0b030fb807e1a92a8b0a507b0207d.zip
Merge "Fix potential invalid memory access for concealment in decodeEnvelope()"
Diffstat (limited to 'libSBRdec/src/env_dec.cpp')
-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;
+ }
}
}
}