Commit graph

115 commits

Author SHA1 Message Date
Rajat Kumar
bcbd383251 Fix to handle missing checks on error returned
Added missing return checks and converted
functions to void which doesn't return anything
other than zero.

Test: Review
Test: atest android.media.cts.DecoderTest
Bug:131183694

Change-Id: Iea7bb9959fffd7a0e4f345f86581a1328e04a38e
Merged-In: Iea7bb9959fffd7a0e4f345f86581a1328e04a38e
2020-09-10 12:48:42 -07:00
Rajat Kumar
514510a33c Fix for build errors with -Wunreachable-code-loop-increment flag am: 750dd58c8d am: ce1b551e99
Change-Id: I0bfff50cf05734d3033f9ac9581807f44c05b6e4
2020-05-15 02:56:25 +00:00
Rajat Kumar
750dd58c8d Fix for build errors with -Wunreachable-code-loop-increment flag
For loop was redundant as the execution
was being done for once. Hence removed in the
present fix.

Bug: 156359506
Test: Build with -Wunreachable-code-loop-increment flag added
Test: xaacdec

Change-Id: I252551cff09fa9b033ef715127ee153645e3055f
2020-05-14 23:34:56 +05:30
Ray Essick
45895b998a Typos: persistant -> persistent
Bug: 141290162
Test: build
Change-Id: I204e2a069cc306736f2a6e2dbc92b132a5c919ef
2020-04-02 09:04:46 -07:00
Tripti Tiwari
72b91f378a Fix for Segv in impd_down_mix function in xaac.
Enough size was not allocated for DRC payload.
Added appropriate size to persistence memory to accommodate maximum
length of DRC payload data. Also added reset for bit-handler elements
after execute call.

Bug:141290162
Test: poc in bug

Change-Id: I61176076056899310a3306818cd5ad4624a4bab0
2020-04-02 09:00:29 -07:00
Rajat Kumar
fdeb26a3f5 Fix for infinite loop in impd_apply_gains_and_add function
if (iEnd == iStart) is true until end line of loop,
and (drc_gain_last == shape_filter_block[g].drc_gain_last)
is also true, this make iEnd unchanged for ever
and the while loop will go into infinite iterations.
Hence added a check to break for the same.

Bug:148433653
Bug:151817831
Test:poc in bug

Change-Id: I2a59cde98abee0f28510a5b50ef44b3efd02c079
2020-03-29 17:08:20 -07:00
TreeHugger Robot
7862de4bd2 Merge "Fix for array out of bound in decoder/drc_src/impd_drc_eq.c" into rvc-dev 2020-03-19 19:07:47 +00:00
Sushanth Patil
40fb6f798f Fix for array out of bound in decoder/drc_src/impd_drc_eq.c
Error return check was missing, which caused an
unchecked value to propagate and lead to array OOB.

Bug: 151407605
Test: poc in bug

Change-Id: I0ab9ced7504314e0a31fbe7138c0b95ecbc8cd84
2020-03-18 20:56:48 +00:00
Rajat Kumar
ed2dbffd88 Fix for array out of bound for type 'ia_filt_cascade_td_struct[4]'
Value is read from the bit stream and used as index
before checking for bounds, added the same as fix here.

Bug: 151412914
Test: poc in bug

Change-Id: I2f484398d87bee0a525e4f31b4f0da4c1b13bb1d
2020-03-18 09:09:45 -07:00
Rajat Kumar
5426a0bf19 Fix for read buffer overflow in impd_filter_banks_process
str_node[k].time is used as index later, added a check
where its calculated.

Bug:146948608
Test:poc in bug

Change-Id: I35ca08ad19045deca44b5b5c55532a84f5a58ed3
2020-03-07 15:00:27 -08:00
Rajat Kumar
f60122a142 Fix for array out of bound in impd_drc_parse_coeff func
Variable num_gain_max_values was used as index in
impd_init_table function without checked
for bounds. Added check to prevent out of bound array
access.

Bug:141524702
Test: poc in bug

Change-Id: Ia902153ef614db6dbd002572cdbdb62421580588
(cherry picked from commit 566b69f066)
2020-03-04 17:23:02 +00:00
Rajat Kumar
74fa48f677 Fix for SBO in impd_drc_selection_process_drcset_selection.c
Index k is incremented and used as an index of
selection_candidate_info_step_2 array. k can be
max (str_drc_instruction_str->dwnmix_id_count *
selection_candidate_step_2_count), this can be
more than max size of selection_candidate_info_step_2
array.

Hence added a check before assignment as fix.

Bug:147331996
Test:poc in bug

Change-Id: I1ffa88eddfcef93ab15a08599270924d54cdf1de
2020-02-20 16:58:14 -08:00
TreeHugger Robot
1207285ca0 Merge "Fix for segv in impd_filter_banks_process function" 2020-01-29 20:41:46 +00:00
TreeHugger Robot
3938795985 Merge "Fix for array bound overflow in ia_gain_set_params_struct." 2020-01-16 01:26:59 +00:00
TreeHugger Robot
da4f7feef2 Merge "Fix for array out of bound in parse drc instruction func" 2020-01-16 00:50:46 +00:00
TreeHugger Robot
3214d04ad9 Merge "Fix for array oob in ia_shape_filter_block_params_struct" 2020-01-15 20:06:21 +00:00
TreeHugger Robot
6606e742ba Merge "Fix for oob in ia_drc_instructions_struct" 2020-01-15 19:58:59 +00: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
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
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
TreeHugger Robot
e57f919f8a Merge "Fix to add few bound checks in DRC, based on code review" 2019-11-14 01:43:53 +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
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
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
Rajat Kumar
f6b2d77787 Fixes to incorporate latest conformance criteria
Bug:128648229
Test: atest android.media.cts.DecoderTestXheAac
Test: atest android.media.cts.DecoderTestAacDrc
Change-Id: Ic85bacc660c91096e29cd0cbe24323f4a6109c9a
2019-07-03 10:23:20 -07:00
Rajat Kumar
7bee3616b8 Fix to remove unused codes from MPEG-D DRC.
MPEG-D DRC integrated with USAC does work only in
time domain.
Hence removed the above related code in this patch.

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

Change-Id: Ib51ef29fb7a1fe7a09718d48e2c9e7cda268ae7b
2019-05-15 15:18:34 -07:00
Ray Essick
360bd4fd75 Merge changes from topic "b124323156"
* changes:
  Initialize all allocated memory blocks to zero
  Update cfi blacklist to include few more assembly functions
  LDR changed to MOV instruction in armv8 and armv7 assemblies
2019-04-02 22:13:05 +00:00
Rajat Kumar
7b43401d30 Initialize all allocated memory blocks to zero
Bug: 124323156
Test: poc
Change-Id: I69b035d1b6bab81244dde319d4fceb3f42837380
2019-03-27 15:49:39 -07:00
Rajat Kumar
b338a5c649 Fix for array and integer overflow in drc related functions
Added init done check before execute calls to avoid access of
uninitialized data.

Bug:126652455
Test: poc
Change-Id: Ia33d05658d3830f27dfe607c4f4e96233c272e20
2019-03-27 13:44:19 -07:00
Ramesh Katuri
fe1d70bf7e Cleanup memory allocation for DRC buffers
This fixes un intialized data access in loudness equalizer selection
Memory allocation and distribution inside DRC module was cleaned up.
Memory clean-up changes were done inside the library and in test bench.
Similar changes were done in OMX and C2 plug-in as well.

Bug: 115509210
Test: vendor+poc
Change-Id: I6a2bf5fe6eeecc5d0fec395af020aef8221a5f93
2019-02-04 12:12:13 -08:00
Rajat Kumar
c300f50cf1 Fix OOB read in impd_drc_uni_sel_proc_process
pstr_drc_uni_sel_proc->drc_config.str_drc_instruction_str
and pstr_drc_uni_sel_proc->drc_config.str_drc_config_ext
.str_eq_instructions  arrays were accessed with -1
indexes, which is implemented as default configuration for no
updation.

Since we have already initialized all the structures to zero
before itself, this assignment is not needed when the indexes
are -1, so the check has been added.

Bug: 122330975
Test: atest android.media.cts.DecoderTestAacDrc
Change-Id: I841c748c53c057db38379c97def6b28fb6421482
2019-01-10 10:50:22 -08:00
TreeHugger Robot
9b6182fe2e Merge "Fix for oobw in impd_manage_drc_complexity() due to drc_set_id" 2019-01-07 19:28:00 +00:00
TreeHugger Robot
322278fed9 Merge "Fix for oobw in impd_manage_eq_complexity() due to eq_set_id" 2019-01-07 19:26:30 +00:00
TreeHugger Robot
7ec9d127e7 Merge "Fix for global buffer overflow in impd_init_loudness_control function" 2019-01-07 17:55:21 +00:00
Ray Essick
174165dd89 Merge "Fix for oobw in impd_parse_drc_instructions_uni_drc()" into pi-dev am: e0c41aae88
am: f462745e36

Change-Id: I48e9385dcb919b7777545aee8a04960d2461f6e9
2019-01-02 19:42:25 -08:00
Ray Essick
e0c41aae88 Merge "Fix for oobw in impd_parse_drc_instructions_uni_drc()" into pi-dev 2019-01-03 03:23:27 +00:00
Ramesh Katuri
eb95e08c41 Merge "Fix for crash due to negative size passed to memcpy" into pi-dev am: a9f6ff8ccc
am: 1e5a543f1f

Change-Id: I0c6f6cbeeeb8877b61d57526c8c08dc67c6c03cd
2019-01-02 14:31:01 -08:00
TreeHugger Robot
a9f6ff8ccc Merge "Fix for crash due to negative size passed to memcpy" into pi-dev 2019-01-02 22:10:34 +00:00
Ray Essick
ff358cfa4e Merge "Fix for oobw in impd_dec_slopes in DRC dynamic payload" into pi-dev am: 622f724911
am: 6c7bac4af8

Change-Id: Ieea4955c915f84e7c150e6427d785bf78f287741
2019-01-02 12:16:53 -08:00
TreeHugger Robot
67f9744ec7 Merge "Fix for oobw in impd_drc_parse_coeff() due to gain_seq_idx" 2018-12-29 00:02:11 +00:00
Ramesh Katuri
f7144dfe8f Fix for oobr in impd_manage_drc_complexity function
bs_gain_set_idx is a 6 bit field read from bitstream, which is used
to access gain_set_index_for_channel_group[] whose size is GAIN_SET_COUNT_MAX
which is 24.bs_gain_set_idx value greater than 23 is causing oob access.

As fix for this issue bound check is added for bs_gain_set_idx

Bug:119263784
Test: vendor
Change-Id: I26d3668c54a739016c1102158c73db49cb35f1c4
2018-12-28 11:45:54 -08:00
Ramesh Katuri
ed831abc65 Fix for oobw in impd_parse_drc_instructions_uni_drc()
gain_set_index_for_channel_group[] is any array of size
CHANNEL_GROUP_COUNT_MAX i.e 24. This array is accessed using
str_drc_instruction_str->num_drc_ch_groups as index, whose
value can be more than 24.

Bound check is added for str_drc_instruction_str->num_drc_ch_groups
before accessing gain_set_index_for_channel_group[]

Bug:117832864
Test: vendor
Change-Id: I3799c2de6926f1193a5e0193bc3b5863c478d4ab
2018-12-21 10:59:49 -08:00
Ramesh Katuri
56a2e1e9c6 Fix for oobw in impd_dec_slopes in DRC dynamic payload
Bug:118143575
Test: vendor
Change-Id: I35940099dc804a96a5790bf8e8b29df049838a17
2018-12-21 10:43:09 -08:00
Ramesh Katuri
a516b49570 Fix for oobw in impd_drc_parse_coeff() due to gain_seq_idx
gain_seq_idx is a 6 bit value read from the bit stream.
it can get any value between 0 to 63. gain_seq_idx is used
to access gain_set_params_index_for_gain_sequence[] array
whose size is SEQUENCE_COUNT_MAX which is 24. if gain_seq_idx
value is greater than or equal to SEQUENCE_COUNT_MAX cause
oob write.

Bound check on gain_seq_idx is added to prevent oob access.

Bug:119117381
Test: vendor
Change-Id: I571e6e705489ae1c46c651f87491f15428719b30
2018-12-21 10:11:38 -08:00
Ramesh Katuri
ce4e2da628 Fix for oobw in impd_manage_drc_complexity() due to drc_set_id
drc_set_id is a 6 bit filed read from bitstream. This drc_set_id is
used to access drc_set_id_valid_flag[] array whose size is
DRC_INSTRUCTIONS_COUNT_MAX i.e. 36. drc_set_id value greater than or
equal to 36 is causing oob write.

Bound check has been added for drc_set_id

Bug:119261935
Test: vendor
Change-Id: Ib218f4d72d23a2cbf4e74eea6a2d71ae8a735c6d
2018-11-29 16:24:19 -08:00
Ramesh Katuri
cc2fdf7714 Fix for oobw in impd_manage_eq_complexity() due to eq_set_id
str_eq_instructions->eq_set_id is a 7 bit field read from bit stream,
whose value can be between 0 to 127.eq_set_id_valid_flag[] is an array
of size EQ_INSTRUCTIONS_COUNT_MAX(8).eq_set_id_valid_flag[] array is
accessed using eq_set_id as offset. str_eq_instructions->eq_set_id
value greater than EQ_INSTRUCTIONS_COUNT_MAX is causing OOB write

Bound check is added for str_eq_instructions->eq_set_id

Bug:119263248
Test: vendor
Change-Id: I3e10e4769fd8db130ffed8e5c703480e6a8c4312
2018-11-29 16:18:35 -08:00