From 29d968bd4cf5d17cddf02806b3d96049a6a7c463 Mon Sep 17 00:00:00 2001 From: Yash Patil Date: Fri, 1 Sep 2023 16:04:23 +0530 Subject: [PATCH] Fix for undefined shift in ducker_apply These changes handle the Undefined-shift runtime error reported because value of Q factor calculated was negative when denominator is zero in division operation. Bug: ossFuzz:61698 Test: poc in bug --- decoder/ixheaacd_mps_decorr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/decoder/ixheaacd_mps_decorr.c b/decoder/ixheaacd_mps_decorr.c index 00a0271..5c0a55c 100644 --- a/decoder/ixheaacd_mps_decorr.c +++ b/decoder/ixheaacd_mps_decorr.c @@ -837,6 +837,9 @@ static VOID ixheaacd_ducker_apply( if (ixheaacd_mps_comp(temp3, temp_1, &qtemp, qtemp1)) { temp_2 = ixheaacd_mps_div_32(temp3, temp_1, &qtemp2); qtemp2 = qtemp2 + qtemp - qtemp1; + if (temp_1 == 0) { + qtemp2 = qtemp; + } temp3 = qtemp2 > 28 ? MAX_32 : 4 << qtemp2; if (temp_2 > temp3) {