Skip to content

Commit f1d0152

Browse files
Shashank Pathmudidivya-bm
authored andcommitted
Fix for integer-overflow in ixheaacd_map_index_data
Significance: ============ This change addresses a corner case arithmetic operations involving addition, subtraction and multiplication. Bug: ossFuzz: 476187661 Test: poc in bug
1 parent 866c545 commit f1d0152

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

decoder/ixheaacd_mps_bitdec.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ static IA_ERRORCODE ixheaacd_factor_funct(WORD32 ott_vs_tot_db, WORD32 quant_mod
13921392
WORD32 constfact;
13931393

13941394
if (ott_vs_tot_db > 0) return IA_XHEAAC_MPS_DEC_EXE_FATAL_INVALID_MPS_PARAM;
1395-
db_diff = -ott_vs_tot_db;
1395+
db_diff = ixheaac_negate32_sat(ott_vs_tot_db);
13961396

13971397
switch (quant_mode) {
13981398
case QUANT_MODE_0:
@@ -1416,7 +1416,9 @@ static IA_ERRORCODE ixheaacd_factor_funct(WORD32 ott_vs_tot_db, WORD32 quant_mod
14161416

14171417
if (db_diff > (x_linear << 5)) {
14181418
WORD32 db_diff_fix = db_diff >> 5;
1419-
*factor = (db_diff_fix - (WORD32)x_linear) * constfact + ONE_IN_Q24;
1419+
*factor = ixheaac_add32_sat(
1420+
ixheaac_sat64_32(ixheaac_mult64(ixheaac_sub32_sat(db_diff_fix, x_linear), constfact)),
1421+
ONE_IN_Q24);
14201422
} else {
14211423
*factor = ONE_IN_Q24;
14221424
}

0 commit comments

Comments
 (0)