From 596d7910595d314ed2d67ffaceba73ec9c0e7184 Mon Sep 17 00:00:00 2001 From: Yash Patil Date: Fri, 15 Sep 2023 19:10:00 +0530 Subject: [PATCH] Fix for Divide-by-zero in ixheaacd_lpc_to_td This changes handle the Divide-by-zero runtime error reported while calculating the gain because imaginary and real data were zero. Bug: ossFuzz:61788 Test: poc in bug --- decoder/ixheaacd_tcx_fwd_mdct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/decoder/ixheaacd_tcx_fwd_mdct.c b/decoder/ixheaacd_tcx_fwd_mdct.c index 267af0d..3fd55e8 100644 --- a/decoder/ixheaacd_tcx_fwd_mdct.c +++ b/decoder/ixheaacd_tcx_fwd_mdct.c @@ -165,7 +165,7 @@ VOID ixheaacd_lpc_to_td(FLOAT32 *coeff, WORD32 order, FLOAT32 *gains, WORD32 lg) for (i = 0; i < size_n / 2; i++) { gains[i] = - (FLOAT32)(1.0f / sqrt(data_r[i] * data_r[i] + data_i[i] * data_i[i])); + (FLOAT32)(1.0f / (sqrt(data_r[i] * data_r[i] + data_i[i] * data_i[i]) + FLT_EPSILON)); } return;