From e34ec6918e47c70542bb2829b2f67d0a1aeff921 Mon Sep 17 00:00:00 2001 From: Rajat Kumar Date: Mon, 29 Apr 2019 18:55:03 +0530 Subject: Fix for stack buffer overflow in ixheaacd_esbr_chirp_fac_calc. We found that error return was not being handled properly in ixheaacd_applysbr() function. This led to a wrong value being propagated which led to a stack buffer overflow. Also, a flag for checking if any previous frames encountered a fatal error has been added to ensure that further processing of frames doesn't happen after encountering a fatal error. Bug:130219994 Bug:131307285 Test: vendor Change-Id: If7b3887afcb375dda292082438f61d156027b60e --- decoder/ixheaacd_freq_sca.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'decoder/ixheaacd_freq_sca.c') diff --git a/decoder/ixheaacd_freq_sca.c b/decoder/ixheaacd_freq_sca.c index 1694307..f48901a 100644 --- a/decoder/ixheaacd_freq_sca.c +++ b/decoder/ixheaacd_freq_sca.c @@ -610,7 +610,7 @@ WORD32 ixheaacd_derive_noise_freq_bnd_tbl( kx = pstr_freq_band_data->freq_band_table[HIGH][0]; if (ptr_header_data->noise_bands == 0) { - pstr_freq_band_data->num_nf_bands = 1; + temp = 1; } else { temp = pstr_common_tables->log_dual_is_table[k2] - pstr_common_tables->log_dual_is_table[kx]; @@ -620,13 +620,12 @@ WORD32 ixheaacd_derive_noise_freq_bnd_tbl( if (temp == 0) { temp = 1; } - pstr_freq_band_data->num_nf_bands = temp; } - pstr_freq_band_data->num_if_bands = pstr_freq_band_data->num_nf_bands; - - if (pstr_freq_band_data->num_nf_bands > MAX_NOISE_COEFFS) { + if (temp > MAX_NOISE_COEFFS) { return -1; } + pstr_freq_band_data->num_nf_bands = temp; + pstr_freq_band_data->num_if_bands = pstr_freq_band_data->num_nf_bands; { WORD16 i_k, k; WORD16 num, den; -- cgit v1.2.3 From f6b2d777878b43a04b8930dd5edeca485d617f58 Mon Sep 17 00:00:00 2001 From: Rajat Kumar Date: Tue, 5 Mar 2019 13:23:27 +0530 Subject: Fixes to incorporate latest conformance criteria Bug:128648229 Test: atest android.media.cts.DecoderTestXheAac Test: atest android.media.cts.DecoderTestAacDrc Change-Id: Ic85bacc660c91096e29cd0cbe24323f4a6109c9a --- decoder/ixheaacd_freq_sca.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'decoder/ixheaacd_freq_sca.c') diff --git a/decoder/ixheaacd_freq_sca.c b/decoder/ixheaacd_freq_sca.c index 1694307..29ddd66 100644 --- a/decoder/ixheaacd_freq_sca.c +++ b/decoder/ixheaacd_freq_sca.c @@ -421,10 +421,6 @@ WORD16 ixheaacd_calc_master_frq_bnd_tbl( ixheaacd_aac_shellsort(vec_dk0, num_bands0); - if (vec_dk0[0] == 0) { - return -1; - } - f_master_tbl[0] = k0; for (k = 1; k <= num_bands0; k++) -- cgit v1.2.3 From 3d1e5dab8169d72595eb36c436eb12b1af2eebe3 Mon Sep 17 00:00:00 2001 From: Rajat Kumar Date: Wed, 24 Apr 2019 18:55:50 +0530 Subject: Fix for integer overflow in libxaac/decoder/ixheaacd_freq_sca.c Replaced 32*32 multiplication to 64*64 and moved right shift operation to resultant 64 bit number, before storing it back to 32 bit register. Bug:130494634 Bug:131214091 Bug:132893904 Test: poc in bug Change-Id: I8977f0df4891a2f6edcc1a360f707e34da5b54bd --- decoder/ixheaacd_freq_sca.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'decoder/ixheaacd_freq_sca.c') diff --git a/decoder/ixheaacd_freq_sca.c b/decoder/ixheaacd_freq_sca.c index f1b6549..e98c6c2 100644 --- a/decoder/ixheaacd_freq_sca.c +++ b/decoder/ixheaacd_freq_sca.c @@ -253,7 +253,7 @@ ixheaacd_calc_stop_band(WORD32 fs, const WORD32 stop_freq, FLOAT32 upsamp_fac) { result = k1_min; for (i = 0; i < stop_freq; i++) { - result = result + arr_diff_stop_freq[i]; + result = ixheaacd_add32_sat(result, arr_diff_stop_freq[i]); } return (result); @@ -401,8 +401,7 @@ WORD16 ixheaacd_calc_master_frq_bnd_tbl( num_bands1 = bands * num_bands1; if (ptr_header_data->alter_scale) { - num_bands1 = num_bands1 * (0x6276); - num_bands1 = num_bands1 >> 15; + num_bands1 = (WORD32)(((WORD64)num_bands1 * (0x6276)) >> 15); } num_bands1 = num_bands1 + 0x1000; -- cgit v1.2.3 From 93ade1f683b597b0eb49633cc6102318a382e595 Mon Sep 17 00:00:00 2001 From: Rajat Kumar Date: Wed, 20 Mar 2019 08:57:35 +0530 Subject: Fix to define all tables as const in libxaac libxaac had few tables which were not declared as constants. Added const and did corresponding changes to build and execute. Bug:128433649 Test: Manual Review Change-Id: I1babf22a45fbd595c5a9c67804ecdc0317ebb96c --- decoder/ixheaacd_freq_sca.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'decoder/ixheaacd_freq_sca.c') diff --git a/decoder/ixheaacd_freq_sca.c b/decoder/ixheaacd_freq_sca.c index f1b6549..91ec487 100644 --- a/decoder/ixheaacd_freq_sca.c +++ b/decoder/ixheaacd_freq_sca.c @@ -49,13 +49,13 @@ #include "ixheaacd_freq_sca.h" #include "ixheaacd_intrinsics.h" -WORD32 ixheaacd_samp_rate_table[12] = {92017, 75132, 55426, 46009, - 37566, 27713, 23004, 18783, - 13856, 11502, 9391, 16428320}; +const WORD32 ixheaacd_samp_rate_table[12] = {92017, 75132, 55426, 46009, + 37566, 27713, 23004, 18783, + 13856, 11502, 9391, 16428320}; -WORD32 ixheaacd_v_offset_40[16] = {3 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, - 2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, - 2 + 1, 2 + 1, 1 + 1, 0}; +const WORD32 ixheaacd_v_offset_40[16] = { + 3 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, + 2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, 2 + 1, 1 + 1, 0}; static WORD32 ixheaacd_int_div(WORD32 num, WORD32 den) { if (den != 0) { -- cgit v1.2.3 From ce7b4e93ce31acde7c368e2a27a57070eef8144b Mon Sep 17 00:00:00 2001 From: Ramesh Katuri Date: Thu, 24 Jan 2019 16:42:36 +0530 Subject: Fix for correcting #include delimiters This CL contains changes to make #include delimiters stying consistent. For all system files inclusion we will use <> and all user files we will use "" Bug: 125443111 Test: compilation Change-Id: Ie5f609b9bef8357877affb7f48d46df7c387d142 --- decoder/ixheaacd_freq_sca.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'decoder/ixheaacd_freq_sca.c') diff --git a/decoder/ixheaacd_freq_sca.c b/decoder/ixheaacd_freq_sca.c index 2feb620..efef7b8 100644 --- a/decoder/ixheaacd_freq_sca.c +++ b/decoder/ixheaacd_freq_sca.c @@ -22,15 +22,15 @@ #include #include #include "ixheaacd_sbr_common.h" -#include +#include "ixheaacd_type_def.h" #include "ixheaacd_constants.h" -#include -#include -#include +#include "ixheaacd_basic_ops32.h" +#include "ixheaacd_basic_ops16.h" +#include "ixheaacd_basic_ops40.h" #include "ixheaacd_basic_ops.h" -#include +#include "ixheaacd_basic_op.h" #include "ixheaacd_intrinsics.h" #include "ixheaacd_common_rom.h" #include "ixheaacd_basic_funcs.h" @@ -39,7 +39,7 @@ #include "ixheaacd_sbr_scale.h" #include "ixheaacd_lpp_tran.h" #include "ixheaacd_env_extr_part.h" -#include +#include "ixheaacd_sbr_rom.h" #include "ixheaacd_hybrid.h" #include "ixheaacd_ps_dec.h" #include "ixheaacd_env_extr.h" -- cgit v1.2.3