aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2019-01-02 12:46:23 -0800
committerandroid-build-merger <android-build-merger@google.com>2019-01-02 12:46:23 -0800
commit8d06f35f31eae5dd73b5ac16ef797023395bda99 (patch)
tree7b40fb0eda9a0f44afcf0f1c3893ffeb32530a6f
parent8bdeed59aa956c50f5a70cfa7ea8a66b16278fe2 (diff)
parent3942213f19c242af6cf2768fee0cbb7f26c02ddc (diff)
downloadfdk-aac-8d06f35f31eae5dd73b5ac16ef797023395bda99.tar.gz
fdk-aac-8d06f35f31eae5dd73b5ac16ef797023395bda99.tar.bz2
fdk-aac-8d06f35f31eae5dd73b5ac16ef797023395bda99.zip
Merge "Add sanity check in huff_decode()"
am: 3942213f19 Change-Id: I33db3f469583b7490860fb5f79189da6c5519085
-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) {