Commit graph

536 commits

Author SHA1 Message Date
TreeHugger Robot
6a015d6931 Merge "Fix for integer overflow in ixheaacd_add32 function" 2020-01-15 00:25:33 +00:00
TreeHugger Robot
f8f448a82f Merge "Fix for heap buffer overflow in set sbr persistent buffer" 2020-01-13 18:45:51 +00:00
Sushanth Patil
af0071f0e3 Fix for use of uninitialsied value in ixheaacd_bass_post_filter
Uninitialsed float arrays were initialised with -nan/nan values
which got propagated in the code flow and crashed in an "if"
statement where a varibale whose value was nan was compared to
a constant.

Bug: 140094983

Change-Id: I70a18ca213f00a6d6d75b5a64951ffc60205bfb2
2020-01-11 19:39:10 -08:00
Rajat Kumar
acd1da2eb8 Fix for integer overflow in ixheaacd_block.c file
(b == 0) case is not taken care in
ixheaacd_shr32_drc function. Hence
added here.

Bug:140980272
Test: poc in bug

Change-Id: Ie830855dd8dc4bebba0b1742f5aada4cdcb48e0d
2020-01-11 19:32:33 -08:00
Rajat Kumar
09fd1c3c1f Fix for array out of bound in parse drc instruction func
target_channel_count read from bit stream is being
used as index without bound check. Hence the check
has been added.

Bug:142693847
Test: poc in bug

Change-Id: I9d6c832e75b9cb78fe4989516d13707f1ecf7f91
2020-01-11 19:10:09 -08:00
Rajat kumar
4a19deca5d Fix for array bound overflow in ia_gain_set_params_struct.
Max value of
str_p_loc_drc_coefficients_uni_drc->gain_set_count_plus
is used as index without checking for upper bound.
Hence added a check here.

Bug:144665190
Test:poc in bug

Change-Id: Ibd8dfe91910eb4d7548cf3236065eb38121b60c8
2020-01-11 19:03:43 -08:00
Rajat kumar
33026c922d Fix for SBO in ixheaacd_enery_calc_persfb function
start_pos was used as an index to access a stack memory
before been checked for bounds. Hence, Added the check

Bug:144476750
Test: poc in bug

Change-Id: Ib019dab8d83bae0ba085a4c2c15a19631d3695df
2020-01-11 17:34:55 -08:00
Tripti Tiwari
3bb1d13705 Fix for heap-buffer-overflow in ixheaacd_read_bits_buf.
During bitbuffer search for sync word, the buffer is incremented each
time in the loop. However, in the second initialization, this size
is not taken care of.
As a fix, reduced the size appropriately in the second init.

Bug:145727847
Test:poc in bug

Change-Id: Id1079d2feeba6841675562e0e1f7b7983acd1b35
2020-01-11 17:27:28 -08:00
Rajat kumar
7924f0cb44 Fix for array oob in ia_shape_filter_block_params_struct
pstr_gain_modifiers->shape_filter_idx is read from
bitstream and used as an index before been checked
for bound. Hence added a check.

Bug:145043907
Test:poc in bug

Change-Id: I9a46c4227017328f2c3aa6e7d911889c01efef91
2020-01-11 17:22:27 -08:00
Rajat kumar
7d0a228c3e Fix for segv in impd_filter_banks_process function
str_node[k].time calculated here is used as an index
to access buf_interpolation->lpcm_gains array. Added a
check here so that the access does not go out of bound.

Bug:145043038
Test:poc in bug

Change-Id: I7620efcfb79e9a34b175b2cdf60c1674c279135d
2020-01-11 17:07:02 -08:00
Rajat Kumar
86d7dd791e Fix for oob in ia_drc_instructions_struct
drc_config->drc_instructions_uni_drc_count
+ drc_config->dwnmix_instructions_count is
used as index in the function
impd_drc_gen_instructions_for_drc_off,
without checked for bounds.

Hence the check has been added here.

Bug:143517852
Test: poc in bug

Change-Id: I1134236b421d97097a5deb25dbf889f25e7a29ef
2020-01-11 16:50:54 -08:00
Rajat kumar
fcc838f01b Fix for integer-overflow in ixheaacd_tns_ar_filter_fixed_armv8
Added saturation check to avoid integer overflow
while addition.

Bug:143791665
Test: poc in bug

Change-Id: Ifbe410b5b4adede8417109a0cb37fd7bdc9f947c
2020-01-11 16:39:29 -08:00
Rajat kumar
b2007999c1 Fix for integer overflow in ixheaacd_add32 function
Added saturation check after two 32 bit numbers
are added and stored in a 32 bit register

Bug: 144391058
Test: Poc in bug

Change-Id: I56c0c626bffb5ffa2bf36456115a093366b84332
2020-01-09 14:57:32 -08:00
Rajat Kumar
bdaf57013d Fix for array out of bound access in gain_set_param structure
Added check before accessing the index.

Bug:141289121
Test: poc in bug

Change-Id: Ifd7bfcb2e978317069efea43ba64f2fb60b9e644
2020-01-09 14:48:29 -08:00
Rajat Kumar
0e6ba25314 Fix for array out of bound esbr_envcalc file.
Added bound checks before access

Bug:131878685
Test: poc in bug

Change-Id: Ibd8dec7875509fc98f7c57d000bcc3635f36f297
2020-01-09 14:24:30 -08:00
Sushanth Patil
da82edd619 Fix for int-oveflow in ixheaacd_sub32
Added check for subtraction overflow.

Bug:144813972
Test: poc in bug
Change-Id: Ic923f0b0f155f196aca85128d7993d7f355d0e13
2020-01-07 15:24:37 -08:00
TreeHugger Robot
e57f919f8a Merge "Fix to add few bound checks in DRC, based on code review" 2019-11-14 01:43:53 +00:00
TreeHugger Robot
52ca260630 Merge "Fix for array out of bound in drc dynamic payload." 2019-11-14 01:09:15 +00:00
Rajat Kumar
c2cb9c2424 Fix to add few bound checks in DRC, based on code review
Added few checks to avoid out of bound access and
and remove few redundant checks based on review.

Bug:130279444
Test: atest android.media.cts.DecoderTestXheAac
Test: atest android.media.cts.DecoderTestAacDrc

Change-Id: If9a7917eea5d68d4c484d02fca4c755ffa6a9123
2019-11-13 14:23:08 -08:00
Rajat Kumar
dc6af3edb4 Fix for array out of bound in drc dynamic payload.
str_spline_nodes->num_nodes was not checked for bound,
before using as index. Added bound check before access.

Bug:141215451
Test: poc in bug

Change-Id: I9cd78035521731a3f338dc52ebf0afc3a3e5d3ff
2019-11-13 14:12:14 -08:00
Rajat Kumar
deb3f00a38 Fix for array out of bound in api file
Removed the redundant part of code which initilizes
an array with -1 and uses it as index.

Bug:141524696
Test: poc in bug

Change-Id: Ie126ca257dc0f7276c46733b043a84d5a88a062d
2019-11-07 14:32:42 -08:00
TreeHugger Robot
e96e08da90 Merge "Fix for array out of bound in impd_drc_static_payload.c" 2019-11-04 20:45:18 +00:00
Rajat Kumar
8410947cb1 Fix for array out of bound access in envelop calc func.
Added check before accessing index.

Bug:141290158
Test: poc in bug

Change-Id: Ia761cf76344e2d0008d73813c2017f0471f734a9
2019-11-02 09:21:04 -07:00
Rajat Kumar
fb6a48906e Fix for array out of bound in impd_drc_static_payload.c
channel_layout->base_channel_count was not checked
for bounds after it is read from bit stream.
Corresponding check has been added here.

Bug:140979418
Test: poc in bug

Change-Id: I57e6a4ea9a39c64e82c3add0d20a85716ad20cc1
2019-11-02 07:03:49 -07:00
Rajat Kumar
0d2d1af703 Fix for heap buffer overflow in set sbr persistent buffer
Maximum CC CHANNEL element supported in xaac decoder
is only two, but we are getting more for this
error stream, leading to heap buffer overflow.
Hence a check is added.

Bug:141344322
Test: poc in bug

Change-Id: Ib63b4c74e66d9e37c85153c87341de0601044bec
2019-11-02 06:55:04 -07:00
Rajat Kumar
4c2758690d Fix to handle infinite loop in reset hf generator function
Added break condition when no indexes are modified and
while loop enters infinite iterations.

Bug:140986186
Test: poc in bug

Change-Id: Ibf5953c0af7a0b96c50e3a2f1095b5cc30825711
2019-10-21 10:11:26 -07:00
Rajat Kumar
8d9d3d1d58 Fix for non-handling of fatal error returned during init.
Fatal error returned from previous init call was not handled
during subsequent init calls. This check has been added here.

Bug:140984035
Bug:140988475
Bug:140986175
Test: poc in bug

Change-Id: I37599ba304bbf137b1a590c1fec7e0da236f7308
2019-10-12 16:28:30 -07:00
TreeHugger Robot
58aa3e2ad5 Merge "Fix for unitialized memory access at ixheaacd_add32_sat3" 2019-08-27 22:05:45 +00:00
TreeHugger Robot
7c44e0aac5 Merge "Adding bound checks in USAC config bit stream parsing" 2019-08-27 20:13:53 +00:00
Ray Essick
65a3c3bb70 Merge "Fix for signed integer overflow at ixheaacd_mps_hyb_filt_type1" 2019-08-26 22:46:32 +00:00
Ramesh Katuri
ce7b4e93ce 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
2019-08-26 13:35:44 -07:00
Ray Essick
c1634d122e Merge "Fix for integer overflow in libxaac/decoder/ixheaacd_freq_sca.c" 2019-08-26 19:32:49 +00:00
Sushanth Patil
e765682ee7 Fix for heap-buffer-overflow in ixheaacd_samples_sat
Output memory size initialised was not sufficient for the
case when audio preroll is 3 and core_sbr_framelength = 4.

Hence, it has been increased to accomodate for the same.

Bug: 136441188
Test: poc in bug

Change-Id: I4e21395f46f4b16c538bf5522b92ad0836ece67f
2019-07-31 14:04:45 -07:00
TreeHugger Robot
2244422be0 Merge "Fix for int overflow in voronoi_idx_dec and voronoi_search function" 2019-07-24 00:35:56 +00:00
TreeHugger Robot
354dcb59b2 Merge "Fix for global buffer overflow in error handler function" 2019-07-23 23:17:30 +00:00
Ray Essick
78d29e53d2 Merge "Fix for potential stack buffer overflow in ixheaacd_lpp_tran.c" 2019-07-23 22:26:08 +00:00
Rajat Kumar
61cdf5e6b5 Fix for global buffer overflow in error handler function
Added error handling for few unhandled error
returned from library to ixheaacd_error.c file.

Bug:133133640
Test: poc in bug

Change-Id: I584da0278ebcb04fc48538b5ae55e8ab2e65c684
2019-07-23 14:59:21 -07:00
Sushanth Patil
60dd57536f Fix for heap buffer overflow in show bits buf
We observed that ptr_read_next in ixheaacd_show_bits_buf()
would go beyond ptr_bit_buf_end in the corner case when
the bitbuffer is exhausted i.e cnt_bits = no_of_bits
case in the current logic of the code.

A different logic has been applied at the corner case in
this patch similar to the one already present in
ixheaacd_read_bits_buf().

Added check to handle the case when both cnt_bits and
no_of_bits come as zero.

Bug: 132050349

Test: poc in bug

Change-Id: I79e1d1e7a4f213c4802e5f7f28a5c419a8d01136
2019-07-22 15:23:47 -07:00
Rajat Kumar
4f06fb9796 Fix for potential stack buffer overflow in ixheaacd_lpp_tran.c
Added bound check for bw_index[patch] before using it as
index.

Bug:135077036
Test: Manual review

Change-Id: Ifb934cc2485596aa906f4a129df87b1b21d9da1f
2019-07-22 14:22:43 -07:00
Rajat Kumar
5cc187a97f Fix for int overflow in voronoi_idx_dec and voronoi_search function
Added addition and substraction saturation checks

Bug:131875460
Test: poc in bug

Change-Id: Ifb235ebc43f18216773900e56d67b419e87d0e0f
2019-07-22 14:10:10 -07:00
TreeHugger Robot
07a470cab1 Merge "Fix for negative-size-param for memcpy in ixheaacd_sbr_env_calc" 2019-07-18 08:57:36 +00:00
TreeHugger Robot
bf9a41e1ef Merge "Fix for SEGV in ixheaacd_usac_process" 2019-07-18 04:02:32 +00:00
Sushanth Patil
70ac75945f Fix for negative-size-param for memcpy in ixheaacd_sbr_env_calc
stere_config_index was not intialised to 0 whenever
a codec re-configure happened which lead to current
frame being processed with stereo_config_index of
frame before codec re-configure which lead to a
mismatch of usac_ele_type[] & stere_config_index
in this case which lead to setting mps_sbr_flag even
in its absence which further went on to crash in
memcpy for ch = 2 which was not set for current
usac_ele_type[].

So, stereo_config_index is cleared in init_config
for USAC_SCE & USAC_LFE cases where it is not used.

Bug: 136975538
Test: poc in bug

Change-Id: I7b976f9512ce3d940a43e94309e61ec780e096cc
2019-07-17 16:21:00 -07:00
Rajat Kumar
a3bcab8198 Fix for SEGV in ixheaacd_usac_process
pstr_dec_data->str_usac_data.pstr_esbr_dec is
initialised only when sbr_ratio_idx > 0. We use
this structure when stereo_config_index > 0,
without checking sbr_ratio_idx > 0. Hence a check
has been added as a fix.

Bug:136061116
Test: poc in bug

Change-Id: I7e8c687f4e77b51e81b3f4add752c37a63f09dbf
2019-07-17 15:00:07 -07:00
Rajat Kumar
93ade1f683 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
2019-07-17 12:24:16 -07:00
Ramesh Katuri
5775ff7635 Adding bound checks in USAC config bit stream parsing
These were added based on code review

Bug:130111727
Bug:131212731

Test: poc in bug

Change-Id: Ibe55885956e12ffacc54d809f67c466e20f0eb4d
2019-07-16 15:21:25 -07:00
Rajat Kumar
ff0048f5cb Fix for unitialized memory access at ixheaacd_add32_sat3
Initilized arrays in ixheaacd_imdct.c file responsible for
unitilized memory access at ixheaacd_add32_sat3.

Bug:131390601
Test: poc in bug

Change-Id: Iefea5ce309f95d3def733691a2351021bc6acec9
2019-07-16 15:17:11 -07:00
Rajat Kumar
fbf81eb94e Fix for integer overflow in imdct related functions
Added saturation checks across ixheaacd_imdct.c and
ixheaacd_basic_ops.c file to avoid integer overflow
based on fuzzer testing and code review.

Bug:130497287
Bug:137055524
Bug:131193902

Test: poc in bug

Change-Id: Ice86d1cc70edfb1831ae5f08942a2f834be25102
2019-07-16 15:09:51 -07:00
Rajat Kumar
49a3a0788a Fix for signed integer overflow at ixheaacd_mps_hyb_filt_type1
Added saturation checks in ixheaacd_mps_hyb_filt_type1 and
ixheaacd_mps_hyb_filt_type2 functions to avoid integer
overflows.

Bug:130493471
Bug:131296731
Test: poc in bug

Change-Id: I1e7febaf1cebc88652fa100a07d45bc3921951bc
2019-07-16 12:51:35 -07:00
Rajat Kumar
3d1e5dab81 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
2019-07-16 11:10:33 -07:00