diff options
author | Akshay Ragir <akshay.ragir@ittiam.com> | 2023-08-30 16:59:42 +0530 |
---|---|---|
committer | Divya B M <89966460+divya-bm@users.noreply.github.com> | 2023-08-31 09:12:21 +0530 |
commit | 5e7d72a06581fce655ad40625cdeec6716f34093 (patch) | |
tree | 52b210d8de5501a2bbf4269c6ddce8417f412d3a /encoder/iusace_fd_fac.c | |
parent | e5650552a2296f8c4f5533bb59651f3375a5c4a3 (diff) | |
download | libxaac-5e7d72a06581fce655ad40625cdeec6716f34093.tar.gz |
Fix for the Divide-by-zero in iusace_fd_fac
These changes handle the Divide-by-zero runtime
error reported because of the inappropriate
usage of pstr_acelp->len_frame in Frequency
Domain coding.
Bug: ossFuzz:61669
Test: poc in bug
Diffstat (limited to 'encoder/iusace_fd_fac.c')
-rw-r--r-- | encoder/iusace_fd_fac.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/encoder/iusace_fd_fac.c b/encoder/iusace_fd_fac.c index d4c5ff9..9cc9fed 100644 --- a/encoder/iusace_fd_fac.c +++ b/encoder/iusace_fd_fac.c @@ -185,13 +185,17 @@ IA_ERRORCODE iusace_fd_fac(WORD32 *sfb_offsets, WORD32 sfb_active, FLOAT64 *orig *num_fac_bits = 0; - if (window_sequence == EIGHT_SHORT_SEQUENCE) - fac_len = (pstr_acelp->len_frame / 16); - else - fac_len = (pstr_acelp->len_frame / 8); + if (last_subfr_was_acelp || next_frm_lpd) + { + if (window_sequence == EIGHT_SHORT_SEQUENCE) + fac_len = (pstr_acelp->len_frame / 16); + else + fac_len = (pstr_acelp->len_frame / 8); + + low_pass_line = (WORD32)(sfb_offsets[sfb_active] * fac_len / + (FLOAT32)pstr_acelp->len_frame); + } - low_pass_line = (WORD32)((FLOAT32)sfb_offsets[sfb_active] * (FLOAT32)fac_len / - (FLOAT32)pstr_acelp->len_frame); if (last_subfr_was_acelp) { FLOAT32 *tmp_lp_res = pstr_scratch->ptr_tmp_lp_res; FLOAT32 lpc_coeffs[ORDER + 1]; |