aboutsummaryrefslogtreecommitdiff
path: root/encoder/ixheaace_basic_ops.c
diff options
context:
space:
mode:
authorAkshay Ragir <akshay.ragir@ittiam.com>2023-10-03 10:15:52 +0530
committerDivya B M <89966460+divya-bm@users.noreply.github.com>2023-10-03 19:14:29 +0530
commit56716426e2087e604ee6267129857b409e53ab09 (patch)
tree4f5f843103c9442af361f44d1e9861e4c5f3f40d /encoder/ixheaace_basic_ops.c
parentf48c9bea6406028f4599306e609f60bb8a022374 (diff)
downloadlibxaac-56716426e2087e604ee6267129857b409e53ab09.tar.gz
Fix for the Global-buffer-overflow READ 4 in iusace_quantize_lines
These changes handle the global-buffer-overflow runtime error reported when the tonal difference in the SBR module becomes zero. Bug: ossFuzz: 62261 Test: poc in bug
Diffstat (limited to 'encoder/ixheaace_basic_ops.c')
-rw-r--r--encoder/ixheaace_basic_ops.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/encoder/ixheaace_basic_ops.c b/encoder/ixheaace_basic_ops.c
index c18b430..04b727b 100644
--- a/encoder/ixheaace_basic_ops.c
+++ b/encoder/ixheaace_basic_ops.c
@@ -18,6 +18,8 @@
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
+#include <float.h>
+#include <math.h>
#include "ixheaac_type_def.h"
#include "ixheaac_constants.h"
#include "ixheaace_aac_constants.h"
@@ -33,3 +35,17 @@ WORD ia_enhaacplus_enc_norm32_arr(const WORD32 *word32_arr, LOOPINDEX n) {
}
return (ixheaac_pnorm32(max_bits));
}
+
+FLOAT32 ixheaace_div32(FLOAT32 num, FLOAT32 den) {
+ if (fabs(den) < FLT_EPSILON) {
+ if (den < 0.0f) {
+ return -num;
+ }
+ else {
+ return num;
+ }
+ }
+ else {
+ return num / den;
+ }
+}