Commit graph

536 commits

Author SHA1 Message Date
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
b0c549e5d8 Fix for crash in ixheaacd_esbr_synthesis_regrp
Inside ia_sbr_frame_info_data_struct, limit table is defined as WORD32 lim_table[4][12 + 1];
lim_table is accessed using gate_mode which is defined as WORD32 gate_mode[4];
For all these below issues one of the value of gate_mode is greater than 12, when lim_table
is accessed with more than 12 we are getting some garbage value which is causing pointer
corruption for b/118386824, Heap buffer overflow for b/118389774 and stack buffer overflow
for b/118494588.

As a fix we are returning fatal error if value in gate_mode > 12

Bug:118386824
Bug:118389774
Bug:118494588
Test: vendor
Change-Id: I713c5438f56a13f06f0f76ed22ad96ff667741a4
2018-12-21 09:30:36 -08:00
Ramesh Katuri
97fb283165 Fix for oobw in ixheaacd_decode_init()
seed_value[] is an array of size MAX_NUM_CHANNELS which is 6.
seed_value is accessed using number of channels in the stream.
For the given input number of channels are more than six,which
is causing OOB write.

As fix, check has been added based on number of channels.As
we support only stereo in USAC, we are returning error if
stream contains more than 2 channels.

Bug:119118558
Test: vendor
Change-Id: I3187b0eae0f802ddb82cdc07a9eec1b5910607b4
2018-11-29 16:30:14 -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
Ramesh Katuri
5f84dbecff Fix for crash due to negative size passed to memcpy
In DRC, one of the memcpy is called with uninitialized variable as size,
which is resulting a crash during memcpy.

As a fix all the members of structure str_bit_handler are set to zero.

Bug:115780779
Test: vendor
Change-Id: Ib991f7ca6fde9d448b975b4a9fa34234fa54231e
2018-11-29 12:14:59 -08:00
TreeHugger Robot
657393883b Merge "Fix for Segmentation fault in ixheaacd_sbr_dec_from_mps" into pi-dev 2018-11-28 21:33:31 +00:00
Ramesh Katuri
06c5d85bfd Fix for oobw-in-impd_parse_drc_instructions_uni_drc am: 4692bee50b
am: 9a26915ed2

Change-Id: I9d01f979d2fb637594719d53789ee4afc0e91f3d
2018-11-27 17:31:41 -08:00
Ramesh Katuri
f81b8d0dbd Fix for Segmentation fault in ixheaacd_sbr_dec_from_mps
Bug: 110629822
Test: re-run poc
Change-Id: I5495b01d5d0c779185ff04eb8f1c048f353396b2
(cherry picked from commit 70396d6ced)
2018-11-27 23:22:45 +00:00
Ramesh Katuri
4692bee50b Fix for oobw-in-impd_parse_drc_instructions_uni_drc
Bug:117883804
Test: vendor
Change-Id: I9512dbc1d184ea838572218df3db9e91574c1460
2018-11-27 13:58:34 -08:00
TreeHugger Robot
859712dff3 Merge "Fix for crash in ixheaacd_lt_prediction" 2018-11-27 02:05:25 +00:00
TreeHugger Robot
fcbf01186b Merge "Fix for heap buffer overflow in showbits_7 function" 2018-11-27 02:01:37 +00:00
TreeHugger Robot
f20429551c Merge "Fix for un-initialized value in ixheaacd_acelp_alias_cnx" 2018-11-27 01:59:59 +00:00
Ramesh Katuri
ec6c3bb222 Fix for heap buffer overflow in showbits_7 function
only fetch next byte of input if we actually need it.

Bug: 117655547
Test: vendor
Change-Id: I4b12feb0b92861b75689b54eae207cf1c693023c
2018-11-25 16:34:14 -08:00
Ramesh Katuri
52618d0834 Fix for un-initialized value in ixheaacd_acelp_alias_cnx
In xaacdec even though lpd decoder handle is defined to support 6
channels, only 2 channels are initialized with data (because we
support only stereo in USAC profile). The input stream used for
this issue has 3 channels. When third channel is getting processed
valgrind is reporting un-initialized data usage.

To solve the issue, a conditional check is added based on number
of channels in the bit stream

Bug:117661478
Test: vendor
Change-Id: Iafc63a022d168791f63b79b0c1965182e69cafe6
2018-11-25 15:50:42 -08:00
Ramesh Katuri
c0ead4ba18 Fix for heap buffer overflow in dec data init function
Bug:117935831
Test: vendor + poc
Change-Id: Iede9bd265eebbefda39c3328a5367399e6ace963
2018-11-25 15:36:26 -08:00
Ramesh Katuri
d9c4a50914 Fix for crash in ixheaacd_lt_prediction
Crash was due to integer overflow. To resolve the
integer overflow issue added saturation addition
and subtraction

Bug:116969100

Change-Id: Ib0d21403c3d714b434f893d71d9a32eea9fc9219
2018-11-23 15:35:29 -08:00
Ray Essick
577f7d9147 Merge "Fix for OOB write in mpeg-d drc bit stream parsing by adding bound checks" into pi-dev am: 850b4ba6f3
am: 94c8007f23

Change-Id: Ie1399a552c63c50c5ebb13b180a560303265bfa5
2018-11-21 09:38:33 -08:00
Ray Essick
850b4ba6f3 Merge "Fix for OOB write in mpeg-d drc bit stream parsing by adding bound checks" into pi-dev 2018-11-21 17:21:38 +00:00
Ray Essick
7f8d990145 Merge "Fix for OOB write in td filter casecade parsing" into pi-dev am: 1c63dd338e
am: 0fc68a180f

Change-Id: I6ff3a2b8630b075485a19874d06a701c7b715e67
2018-11-19 20:38:40 -08:00
Ray Essick
1c63dd338e Merge "Fix for OOB write in td filter casecade parsing" into pi-dev 2018-11-20 04:23:25 +00:00
Ramesh Katuri
0cc060d4af Fix for segmentation fault in read spectral data
In this error stream, frame size is coming as zero, because of which
ptr_spec_coef_out is getting memset with a negative value.

Bug:112707186
Test: vendor
Change-Id: Ifa4e7356bbc7bab6f659d817cbf4923d5d5da621
2018-11-18 11:32:36 -08:00
Ramesh Katuri
c9f59f71e5 Fix for global buffer overflow in lt prediction function.
Bug:114746174
Test: vendor
Change-Id: Ifa3424ef7743fb937121ea3a1d0ec07a5cb98a05
2018-11-18 11:04:35 -08:00
Ramesh Katuri
b9df8bbadb Fix for stack buffer underflow in sbr dec
Bug:116774214
Test: vendor, poc no longer reproduces
Change-Id: I2b1121d84d3d561e35952814afd3fe529751757a
2018-11-16 17:15:40 -08:00
Ray Essick
46d91bac30 Merge "Fix for Stack buffer overflow in ixheaacd_mps_getstridemap" into pi-dev am: e0040b411e
am: c103860d52

Change-Id: If00f07dfe2377e6698003476b1fda72c2c1a3fd5
2018-11-16 14:31:52 -08:00
Ray Essick
e0040b411e Merge "Fix for Stack buffer overflow in ixheaacd_mps_getstridemap" into pi-dev 2018-11-16 22:06:08 +00:00
Ray Essick
5c3eb1fc65 Merge "Fix for OOB write in equalizer instructions parsing." into pi-dev am: d498d63513
am: 0905f025b8

Change-Id: Icfc383473a556092ecc362ec2fe22ddbaaff81ec
2018-11-15 15:29:31 -08:00
Ramesh Katuri
7a57950b34 Fix for stack-buffer-underflow in ixheaacd_sbr_env_calc am: 565b25f432
am: e4c01befc0

Change-Id: I58f32245bd0d16f901e8982f6600336bef2cc052
2018-11-15 15:28:44 -08:00
Ray Essick
d498d63513 Merge "Fix for OOB write in equalizer instructions parsing." into pi-dev 2018-11-15 23:03:11 +00:00
Ramesh Katuri
565b25f432 Fix for stack-buffer-underflow in ixheaacd_sbr_env_calc
Bug:117050162
Test: vendor, poc no longer fails
Change-Id: I1ff8f0ce42ade33c93653edc9e19282b68108b9b
2018-11-14 18:31:32 -08:00
Ramesh Katuri
c9ecca9cd8 Fix for OOB write in equalizer instructions parsing.
Bound check was missing for eq_ch_group_count. Added
as fix.

Bug: 117216549
Test: vendor
Change-Id: Ie36446a3604ae1cb2471dad0a938a96f2b7fff64
2018-11-14 18:01:47 -08:00
Ramesh Katuri
bd5770772f Fix for Stack buffer overflow in ixheaacd_mps_getstridemap
Bug:117495103
Bug:117495366
Test: vendor + poc
Change-Id: Iff5b9135a8fc1b9ad1f00b6fdbe6a8e20c0a61c4
2018-11-14 14:56:14 -08:00
Ramesh Katuri
9a89ef5bbc Fix for crash in ixheaacd_decode_init
Sampling frequency of the input stream is read from the bit stream.
As per spec there are 30 standard sampling frequencies.Sampling frequency
index which is a 5 bit filed read from the bit stream. If the input
stream has sampling frequency other than this 30 then sampling index
from the bit stream will be 0x1f. If the sampling frequency index is 0x1f
then sampling frequency is directly read from the bit stream (24 bit).
Even though sampling frequency can be any value between ( 0 and 2^24-1)
as per usac specification this free sampling frequency has to be clamped.
We implemented that clamping as part of this CL.

Bug:117047049
Test: poc + vendor
Change-Id: I5793139521563e5efd03c8ed9cf5aeda0792bef2
2018-11-14 11:55:32 -08:00
Ramesh Katuri
5b5d0a285d Use saturating arithmetic in rotated_gosset_mtx_dec
This fixes signed integer overflow errors

Bug:117049921
Test: poc
Change-Id: I952bae126f0be8cb0ad7437d15d9a64ec8ae19ec
2018-11-13 15:58:59 -08:00
Ramesh Katuri
589d21b8a3 Fix for OOB write in mpeg-d drc bit stream parsing by adding bound checks
Added bound checks for all the parameters which are
derived from bit stream.

Bug:116760188
Bug:116019594
Bug:116114402
Test: vendor
Change-Id: I126cd520e7faf2281ab731da559b11c74a9e30b5
2018-11-07 00:55:26 +00:00
Ramesh Katuri
ae206c1fa5 Fix for OOB write in td filter casecade parsing
Add bounds checks for values delivered as N-bits in the bitstream
but that have smaller allowed range in this implementation.

Bug:116617847
Test: vendor
Change-Id: Iad0c020ceacd2226d8e1af688a52a46179a39a2d
2018-11-06 16:46:03 -08:00
Ramesh Katuri
9da98c5ba9 Use saturating addition in ixheaacd_imdct_process()
Crash was due to addition overflow in ixheaacd_imdct_process().
Used saturating addition to resolve this.

Bug:116843813
Test: vendor
Change-Id: I5f57a377e5e4c27cb04cd3613bbb28a8665dbf75
2018-11-06 16:12:59 -08:00
Ramesh Katuri
8940746da9 Fix for global buffer overflow in impd_init_loudness_control function
Add bounds check on loudness measurement system.

Bug:112768568
Test: vendor
Change-Id: I84f8baeb9a4fd956dcfa74eee0ac5abe44d1f3fc
2018-11-05 11:21:58 -08:00
Ramesh Katuri
c992830e35 Fix for segmentation fault in hf generator
Number of envelopes is becoming zero because of erroneous input
stream.Inside SBR start band and stop band are calculated based
on number of envelope's.

In this case start bands is becoming negative. In sbr processing
buffer is accessed from start to stop band. This is causing OOB
read access

Bug:113037143
Test: poc
Change-Id: Iade10e8cb86676784703e7226b7e132761eb12b1
(cherry picked from commit 4e5b9cb8f6)
2018-11-02 22:53:22 +00:00
Ray Essick
176f86406d Merge changes from topic "b117495362" into pi-dev am: 8fe5da1ed4
am: cdb835c4dc

Change-Id: I354d70de86e98797d9973153d2000f016c0fa6c6
2018-11-01 15:49:11 -07:00
Ray Essick
8fe5da1ed4 Merge changes from topic "b117495362" into pi-dev
* changes:
  Fix for stack buffer overflow in mps ecdata pair decode
  Fix for OOB read in bit stream parsing in mps module
  Clean an array bounds violation.
  Fix for sanitizer multiplication overflow error
  Fix for Segmentation fault in ixheaacd_mps_apply_pre_matrix
2018-11-01 22:14:01 +00:00
Ray Essick
669178420f Merge "Fix for heap buffer overflow in tns block" into pi-dev am: 6511706b0b
am: b69f0f116c

Change-Id: If78275080e2b9cfb68aaae09fbd71718f30a91a6
2018-10-30 15:29:48 -07:00
Ray Essick
e79457567e Merge "Fix for OOB write in loudness info set ext" into pi-dev am: 69e7a92ab9
am: 2dd49bc124

Change-Id: I04e80eafebc7241034af28dc615e385c473a0c4b
2018-10-30 15:24:28 -07:00
Ray Essick
6391584b4a Merge "Fix for OOB write in parsing eq sub band gain vector in drc" into pi-dev am: 86a4367f4c
am: 2b463e4b0a

Change-Id: Id6d1b6f8d44baf643927dd8dba8157566d74a8e6
2018-10-30 15:24:13 -07:00
Ramesh Katuri
85589b0353 Fix for stack buffer overflow in drc loudness control am: 851d0d122a
am: 8a2678ef55

Change-Id: Ic73f4ee2630999d39c270afeda1111370612b928
2018-10-30 15:23:36 -07:00
Ray Essick
6511706b0b Merge "Fix for heap buffer overflow in tns block" into pi-dev 2018-10-30 22:12:07 +00:00
Ramesh Katuri
48b9e0f857 Fix for stack buffer overflow in mps ecdata pair decode
Bug:116971427
Test: vendor
Change-Id: Icb76f5700651ba701b51fdc626e797f0ae86c2cf
2018-10-30 14:56:10 -07:00
Ramesh Katuri
639e7a88a5 Fix for OOB read in bit stream parsing in mps module
icc and cld index are calculated using parameters derived
from bit stream.There is no bound check for icc and cld index,
because of which OOB read is happening in mps parsing

After icc and cld index calculation,values are clamped to
avoid OOB read

Bug:112856493
Bug:112858430
Test: poc
Change-Id: I59905926d8a2d1a532bec33e5998a67531a99bd9
2018-10-30 14:56:10 -07:00
Ray Essick
97123f8e06 Clean an array bounds violation.
unchecked bounds on array that was also 1 entry to small.

Bug: 110596152
Test: vendor
Change-Id: Ia6c0ddd342257177323a87af85fb42ba24eb8d11
2018-10-30 14:56:10 -07:00
Ramesh Katuri
40c1157b52 Fix for sanitizer multiplication overflow error
Bug: 110596152
Test: re-run POC
Change-Id: I24b01b4ab13987abd028f013262f732cd06e81f8
2018-10-30 14:56:10 -07:00