Commit 522a370ea6 for aom
commit 522a370ea6cdd8e65afea5f4726f77d137bf8a2c
Author: Diksha Singh <diksha.singh@ittiam.com>
Date: Thu Apr 23 13:27:39 2026 +0530
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 bd5934044d..2e7acf36de 100644
--- a/av1/common/av1_rtcd_defs.pl
+++ b/av1/common/av1_rtcd_defs.pl
@@ -423,7 +423,7 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
# 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 8486c76abb..45e117bdb8 100644
--- a/av1/encoder/arm/encodetxb_neon.c
+++ b/av1/encoder/arm/encodetxb_neon.c
@@ -576,7 +576,7 @@ static inline void get_16n_coeff_contexts_hor(const uint8_t *levels,
// 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 5e155abc38..f0607b68e0 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -277,7 +277,7 @@ void av1_txb_init_levels_c(const tran_low_t *const coeff, const int width,
}
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 6ef4bc435e..d4923674a9 100644
--- a/av1/encoder/x86/encodetxb_sse2.c
+++ b/av1/encoder/x86/encodetxb_sse2.c
@@ -432,7 +432,7 @@ static inline void get_16n_coeff_contexts_hor(const uint8_t *levels,
// 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 18811913af..2fd3efd2a7 100644
--- a/test/encodetxb_test.cc
+++ b/test/encodetxb_test.cc
@@ -33,8 +33,8 @@ namespace {
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);