aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2019-01-02 12:50:10 -0800
committerandroid-build-merger <android-build-merger@google.com>2019-01-02 12:50:10 -0800
commit04b22fae53c04876b3071804c3afdbd8ad4b7f64 (patch)
tree9e674197abb5954db8562be34a33b2a1674537c9
parente8d354305f6a486d1abd142d292fd23b95fe1f5c (diff)
parent8d06f35f31eae5dd73b5ac16ef797023395bda99 (diff)
downloadfdk-aac-04b22fae53c04876b3071804c3afdbd8ad4b7f64.tar.gz
fdk-aac-04b22fae53c04876b3071804c3afdbd8ad4b7f64.tar.bz2
fdk-aac-04b22fae53c04876b3071804c3afdbd8ad4b7f64.zip
Merge "Add sanity check in huff_decode()" am: 3942213f19
am: 8d06f35f31 Change-Id: I387be28f72d64ea61a1628d296d9abcdf361e54b
-rw-r--r--libFDK/src/nlc_dec.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libFDK/src/nlc_dec.cpp b/libFDK/src/nlc_dec.cpp
index 8a8ccfd..6e98ce0 100644
--- a/libFDK/src/nlc_dec.cpp
+++ b/libFDK/src/nlc_dec.cpp
@@ -647,6 +647,10 @@ static ERROR_t huff_decode(HANDLE_FDK_BITSTREAM strm, SCHAR* out_data_1,
}
df_rest_flag_1 = num_val_1_int % 2;
if (df_rest_flag_1) num_val_1_int -= 1;
+ if (num_val_1_int < 0) {
+ err = HUFFDEC_NOTOK;
+ goto bail;
+ }
}
if (out_data_2 != NULL) {
if (diff_type_2 == DIFF_FREQ) {
@@ -658,6 +662,10 @@ static ERROR_t huff_decode(HANDLE_FDK_BITSTREAM strm, SCHAR* out_data_1,
}
df_rest_flag_2 = num_val_2_int % 2;
if (df_rest_flag_2) num_val_2_int -= 1;
+ if (num_val_2_int < 0) {
+ err = HUFFDEC_NOTOK;
+ goto bail;
+ }
}
if (out_data_1 != NULL) {