Fix coverity integer overflow warning There seemed to be a mismatch in the datatype of argument `eob` in the functions `warehouse_efficients_txb()`and `av1_get_nz_map_contexts()`, leading to integer overflow warning. This patch corrects the same. Fixes Coverity defect CID 560140: Insecure data handling (INTEGER_OVERFLOW) Bug: 505436291 Change-Id: Ibd42ca1b38f97b754a8ef26d65b000d8839b7067
diff --git a/av1/common/av1_rtcd_defs.pl b/av1/common/av1_rtcd_defs.pl index bd59340..2e7acf3 100644 --- a/av1/common/av1_rtcd_defs.pl +++ b/av1/common/av1_rtcd_defs.pl
@@ -423,7 +423,7 @@ # End av1_high encoder functions # txb - add_proto qw/void av1_get_nz_map_contexts/, "const uint8_t *const levels, const int16_t *const scan, const uint16_t eob, const TX_SIZE tx_size, const TX_CLASS tx_class, int8_t *const coeff_contexts"; + add_proto qw/void av1_get_nz_map_contexts/, "const uint8_t *const levels, const int16_t *const scan, const int eob, const TX_SIZE tx_size, const TX_CLASS tx_class, int8_t *const coeff_contexts"; specialize qw/av1_get_nz_map_contexts sse2 neon/; add_proto qw/void av1_txb_init_levels/, "const tran_low_t *const coeff, const int width, const int height, uint8_t *const levels"; specialize qw/av1_txb_init_levels sse4_1 avx2 neon/;
diff --git a/av1/encoder/arm/encodetxb_neon.c b/av1/encoder/arm/encodetxb_neon.c index 8486c76..45e117b 100644 --- a/av1/encoder/arm/encodetxb_neon.c +++ b/av1/encoder/arm/encodetxb_neon.c
@@ -576,7 +576,7 @@ // Note: levels[] must be in the range [0, 127], inclusive. void av1_get_nz_map_contexts_neon(const uint8_t *const levels, - const int16_t *const scan, const uint16_t eob, + const int16_t *const scan, const int eob, const TX_SIZE tx_size, const TX_CLASS tx_class, int8_t *const coeff_contexts) {
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c index 5e155ab..f0607b6 100644 --- a/av1/encoder/encodetxb.c +++ b/av1/encoder/encodetxb.c
@@ -277,7 +277,7 @@ } void av1_get_nz_map_contexts_c(const uint8_t *const levels, - const int16_t *const scan, const uint16_t eob, + const int16_t *const scan, const int eob, const TX_SIZE tx_size, const TX_CLASS tx_class, int8_t *const coeff_contexts) { const int bhl = get_txb_bhl(tx_size);
diff --git a/av1/encoder/x86/encodetxb_sse2.c b/av1/encoder/x86/encodetxb_sse2.c index 6ef4bc4..d492367 100644 --- a/av1/encoder/x86/encodetxb_sse2.c +++ b/av1/encoder/x86/encodetxb_sse2.c
@@ -432,7 +432,7 @@ // Note: levels[] must be in the range [0, 127], inclusive. void av1_get_nz_map_contexts_sse2(const uint8_t *const levels, - const int16_t *const scan, const uint16_t eob, + const int16_t *const scan, const int eob, const TX_SIZE tx_size, const TX_CLASS tx_class, int8_t *const coeff_contexts) {
diff --git a/test/encodetxb_test.cc b/test/encodetxb_test.cc index 1881191..2fd3efd 100644 --- a/test/encodetxb_test.cc +++ b/test/encodetxb_test.cc
@@ -33,8 +33,8 @@ using libaom_test::ACMRandom; using GetNzMapContextsFunc = void (*)(const uint8_t *const levels, - const int16_t *const scan, - const uint16_t eob, const TX_SIZE tx_size, + const int16_t *const scan, const int eob, + const TX_SIZE tx_size, const TX_CLASS tx_class, int8_t *const coeff_contexts);