diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2019-01-02 20:34:44 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-01-02 20:34:44 +0000 |
commit | 3942213f19c242af6cf2768fee0cbb7f26c02ddc (patch) | |
tree | 7b40fb0eda9a0f44afcf0f1c3893ffeb32530a6f | |
parent | b42dfa745b8159ab12b9720f409776cde466d6ec (diff) | |
parent | 443d32ea7fffba4d95a25218ad0119c9696005c2 (diff) | |
download | fdk-aac-3942213f19c242af6cf2768fee0cbb7f26c02ddc.tar.gz fdk-aac-3942213f19c242af6cf2768fee0cbb7f26c02ddc.tar.bz2 fdk-aac-3942213f19c242af6cf2768fee0cbb7f26c02ddc.zip |
Merge "Add sanity check in huff_decode()"
-rw-r--r-- | libFDK/src/nlc_dec.cpp | 8 |
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) { |