From f86897eaad4f72a84862709ac8a44c16fe7ec0c3 Mon Sep 17 00:00:00 2001 From: Tripti Tiwari Date: Mon, 10 Dec 2018 14:45:55 +0530 Subject: [PATCH] Fix for integer overflow in ixheaacd_cal_fac_data Negation overflow occurs in ixheaacd_cal_fac_data. As fix, added saturation check in absolute value calculation. Bug:120250030 Test: vendor Change-Id: Ie310d9d21fc12fc76135fa7b411572d3673fe871 --- decoder/ixheaacd_imdct.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/decoder/ixheaacd_imdct.c b/decoder/ixheaacd_imdct.c index a93b04b..02929b0 100644 --- a/decoder/ixheaacd_imdct.c +++ b/decoder/ixheaacd_imdct.c @@ -254,7 +254,8 @@ WORD8 ixheaacd_cal_fac_data(ia_usac_data_struct *usac_data, WORD32 i_ch, i_aq = NULL; for (k = 0; k < lfac; k++) { - if (ABS(fac_data[k + 1]) > itemp) itemp = ABS(fac_data[k + 1]); + if (ixheaacd_abs32_sat(fac_data[k + 1]) > itemp) + itemp = ixheaacd_abs32_sat(fac_data[k + 1]); } qshift1 = ixheaacd_norm32(itemp);