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
This commit is contained in:
Akshay Ragir 2023-09-01 20:10:04 +05:30 • committed by Divya B M
parent 1ac90c8ac3
commit 112fe0d0db

View file

@ -22,6 +22,7 @@
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <float.h>
#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);