From 112fe0d0dba0531cf540eaeefc21397982ad47da Mon Sep 17 00:00:00 2001 From: Akshay Ragir Date: Fri, 1 Sep 2023 20:10:04 +0530 Subject: [PATCH] Fix for the Global-buffer-overflow READ 4 in iusace_estimate_scfs_chan These changes handle the Global-buffer-overflow runtime error reported when the value of scalefactor band form factor becomes zero. This is resolved by making it closer to zero instead of absolute zero. Bug: ossFuzz:61902 Test: poc in bug --- encoder/ixheaace_fd_qc_adjthr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/encoder/ixheaace_fd_qc_adjthr.c b/encoder/ixheaace_fd_qc_adjthr.c index af53704..320c32a 100644 --- a/encoder/ixheaace_fd_qc_adjthr.c +++ b/encoder/ixheaace_fd_qc_adjthr.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "iusace_type_def.h" #include "ixheaac_error_standards.h" #include "ixheaace_error_codes.h" @@ -1606,7 +1607,7 @@ VOID iusace_estimate_scfs_chan(ia_psy_mod_out_data_struct *pstr_psy_out, min_sf_max_quant[i] = MIN_SHRT_VAL; if ((max_spec > 0.0) && (energy > thresh) && (p_sfb_form_factor[i] != MIN_FLT_VAL)) { - energy_part = (FLOAT32)log10(p_sfb_form_factor[i]); + energy_part = (FLOAT32)log10(p_sfb_form_factor[i] + FLT_EPSILON); thr_part = (FLOAT32)log10(6.75 * thresh + MIN_FLT_VAL); scf_float = 8.8585f * (thr_part - energy_part);