aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYash Patil <yash.patil@ittiam.com>2023-09-22 17:28:33 +0530
committerDivya B M <89966460+divya-bm@users.noreply.github.com>2023-09-22 19:04:19 +0530
commit9ecc713da9b5516c7d3908458797a26ecf4bb4dd (patch)
treeab52225b28f1119e777c4105f791ad28953843f6
parent8da251033eee5a096dbd792405477830f33b37ac (diff)
downloadlibxaac-9ecc713da9b5516c7d3908458797a26ecf4bb4dd.tar.gz
Fix for Undefined-shift in ixheaacd_hcr_decoder
These changes handle the Undefined shift runtime error reported when bit position in huffman codeword reordering operation becomes negative. Bug: ossFuzz:62408 Test: poc in bug
-rw-r--r--decoder/ixheaacd_huff_code_reorder.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/decoder/ixheaacd_huff_code_reorder.c b/decoder/ixheaacd_huff_code_reorder.c
index a9d6ffd..8ca6061 100644
--- a/decoder/ixheaacd_huff_code_reorder.c
+++ b/decoder/ixheaacd_huff_code_reorder.c
@@ -675,7 +675,7 @@ static PLATFORM_INLINE UWORD16 *ixheaacd_huff_dec_pair_hcr_pcw(
ixheaacd_aac_read_byte_corr(&ptr_read_next, bit_pos, read_word,
it_bit_buff->ptr_bit_buf_end);
}
-
+ *bit_pos = max(0, *bit_pos);
read_word1 = *read_word << *bit_pos;
ixheaacd_huffman_decode(read_word1, &index, &length, code_book_tbl,
idx_table);
@@ -814,7 +814,7 @@ static PLATFORM_INLINE UWORD16 *ixheaacd_huff_dec_quad_hcr_pcw(
ixheaacd_aac_read_byte_corr(&ptr_read_next, bit_pos, read_word,
it_bit_buff->ptr_bit_buf_end);
}
-
+ *bit_pos = max(0, *bit_pos);
read_word1 = *read_word << *bit_pos;
ixheaacd_huffman_decode(read_word1, &index, &length, code_book_tbl,
idx_table);
@@ -944,7 +944,7 @@ static UWORD16 *ixheaacd_huff_dec_word_hcr_pcw(
ixheaacd_aac_read_byte_corr1(&ptr_read_next, bit_pos, read_word,
it_bit_buff->ptr_bit_buf_end);
}
-
+ *bit_pos = max(0, *bit_pos);
read_word1 = *read_word << *bit_pos;
ixheaacd_huff_sfb_table(read_word1, &index, &length, code_book_tbl,
idx_table);