Commit graph

57 commits

Author SHA1 Message Date
Ray Essick
34989f97fe DO NOT MERGE Consume bytes for sps with unsupported resolution
For an sps with unsupported resolution, consume the bytes.
Otherwise application will feed the same sps again
and again.

Bug: 65718319
Test: ran POC before/after
Change-Id: I7b2d35b8f31d830f9495682b86b6924bdd2f95d0
Merged-In: Ic81990030f7e6afd8cf3ebd387c5be7443b148b9
Merged-In: I02295e813f37a963d7f6216bb8a7e86648485681
2017-10-31 10:48:35 -07:00
TreeHugger Robot
6587d735fa Merge "Set error skip ctbs as multiple 8x8 pus" into lmp-dev 2017-10-20 19:44:51 +00:00
Naveen Kumar P
2b9fb0c207 Set error skip ctbs as multiple 8x8 pus
Bug: 65123471

This is required for incomplete ctbs at the frame
boundaries

Change-Id: I7e41a3ac2f6e35a929ba4ff3ca4cfcc859a7b867
2017-10-05 13:56:13 -07:00
Ray Essick
2ae456c2a3 Alloc extra bytes for bits buf for parse optimzation
Without this extra allocation, if a nal fills entire bits
buffer, there will be out of bound memory read access.

Bug: 65719872
Test: ran poc before/after on ASAN of master
Change-Id: I9f4fca0739db84db023b1252c1365bfd13355541
Merged-In: I1c36821505bdc4fe6c23f30a02ab2fb0fb657946
2017-10-03 16:04:33 -07:00
Robert Shih
4b5c23e393 Merge "Added an out of bound check on u4_num_bufs in input argument" into lmp-dev 2017-09-13 20:15:11 +00:00
Marco Nelissen
4b9053c15c Merge "Fix tile index buf alloc size" into lmp-dev 2017-09-13 05:00:56 +00:00
Harish Mahendrakar
8221313d58 Added an out of bound check on u4_num_bufs in input argument
ps_dec_ip->s_out_buffer.u4_num_bufs was missing out of bound checks

Bug: 35430570
Change-Id: Ibbf9891a885f69e208107725e34e7217147b891e
2017-09-12 13:13:26 -07:00
Naveen Kumar P
334f896e61 Fix tile index buf alloc size
Bug: 64893226
2017-09-11 15:40:03 -07:00
Naveen Kumar P
f6ba5eae65 Fix heap buffer overflow
Test:
- Push multi_rec.hevc (in the bug thread) to the device
- Build:
mmm external/libhevc
- Run on device:
hevcdec --input multi_res.hevc  --num_frames -1 --num_cores 2

Bug: 62815506

Merged-In: I7e0828c9a9bb1e9997c379544ea5f4eb3556417d
Change-Id: I7e0828c9a9bb1e9997c379544ea5f4eb3556417d
2017-09-08 21:14:34 -07:00
TreeHugger Robot
db15dd7102 Merge "Ensure CTB size > 16 for clips with tiles and width/height >= 4096" into lmp-dev 2017-08-03 18:28:53 +00:00
Harish Mahendrakar
248e72c7a8 Ensure CTB size > 16 for clips with tiles and width/height >= 4096
For clips with tiles and dimensions >= 4096,
CTB size of 16 can result in tile position > 255.
This is not supported by the decoder

Bug: 37930177
Test: ran poc w/o crashing
Change-Id: I2f223a124c4ea9bfd98343343fd010d80a5dd8bd
2017-07-24 12:33:29 -07:00
TreeHugger Robot
f661b00835 Merge "Limit boundary PU sizes in case of errors" into lmp-dev 2017-07-10 19:29:45 +00:00
TreeHugger Robot
493410548a Merge "Check number of output buffers and sizes" into lmp-dev 2017-06-16 23:26:32 +00:00
Naveen Kumar P
e8c26c16d7 Return error for invalid crop parameters
Test: run poc with and without the patch
Bug: 62214264
Change-Id: If627ee9a8f0dbd65963897966e1c2d39f5fbd428
2017-06-15 20:19:16 +00:00
Harish Mahendrakar
62830d130b Limit boundary PU sizes in case of errors
In case of error clips, some PUs are marked as skip.
Ensure such PUs stay within the picture

Bug: 37615911
Test: ran POC included with the bug.
Change-Id: Ie0aeccc752cf556f9dea84de61c15a7906e1060b
2017-06-13 14:54:58 -07:00
Naveen Kumar P
1ffb19f7ae Check number of output buffers and sizes
Bug: 37435531
Bug: 36817631
Bug: 36492741
Change-Id: I85e3da9a8aaefaac0b494868fdc94d858e4cf8e6
2017-06-07 15:28:48 -07:00
TreeHugger Robot
1ce65aea9f Merge "Fix OOB issue in nal unit parsing" into lmp-dev 2017-06-06 20:42:09 +00:00
Marco Nelissen
e30fa58cf0 Merge "DO NOT MERGE Added check for invalid log2_max_transform_block_size in SPS" into lmp-dev 2017-06-06 20:10:10 +00:00
TreeHugger Robot
95cd002d79 Merge "Set pic_present at end of pic_init instead of beginning" into lmp-dev 2017-06-06 19:22:09 +00:00
Harish Mahendrakar
d272cd6369 DO NOT MERGE Added check for invalid log2_max_transform_block_size in SPS
Bug: 33918236
Bug: 33964497
Bug: 33965905
Bug: 33862021
Change-Id: If121221d0f6e983c05d95d123af9bed378d1961f
2017-06-05 14:36:00 -07:00
Naveen Kumar P
62ebc32761 Fix OOB issue in nal unit parsing
Bug: 37712181
Test: ran patched against POC on nyc-mr2
Change-Id: I5408b3afd898db99265f94573d1163ef83c9b99c
2017-06-02 15:20:48 -07:00
Naveen Kumar P
4535874899 Handle error return in parse slice
Bug: 37430213
Change-Id: I77f5973db54edccc0972649035b0fbde961c10dd
(cherry picked from commit 16c8c8cceeb74c7f4634803723a0b8b1f4881dc9)
2017-05-30 09:38:36 -07:00
Naveen Kumar P
d012a1ffc0 Set pic_present at end of pic_init instead of beginning
Bug: 37469795

In pic_init, pic_present was set in the beggining. If pic_present
was set, process and buffer managment were done. For an error
stream, a crash occured when pic_init returned with error after setting
pic_present.

Change-Id: Iea42e6ad2bc5a74517188fa5e4cc434bb96d46c7
2017-05-23 10:32:34 -07:00
Harish Mahendrakar
5204651228 Fix heap buffer overflow while searching for valid PPS
Bug: 37094889
Test: Tested POC on ASAN build
Change-Id: Id4e52cd10a4d5eac015efe4b752162dc39cc30b8
2017-05-16 16:48:29 -07:00
TreeHugger Robot
1853d3871a Merge "Check for buffer overflow in pps/slice header parsing" into lmp-dev 2017-05-16 22:20:33 +00:00
TreeHugger Robot
31e21c5134 Merge "memset SPS to zero" into lmp-dev 2017-05-16 22:18:29 +00:00
Naveen Kumar P
d61d5e5f6a Check for buffer overflow in pps/slice header parsing
Bug: 36215950
Bug: 36215953
Bug: 36216719
Change-Id: Ibdc05e1d5aa21d060d7c683fd9af4bed8537053f
2017-05-15 15:45:50 -07:00
Harish Mahendrakar
2e0e75aede memset SPS to zero
SPS structure is memset to zero in parse_sps()
Bug: 33966031
Bug: 37458993

Change-Id: I7d4c04d2d25d7e9c8f581bd470260fc4394a564b
2017-05-12 16:21:21 -07:00
Marco Nelissen
4629c5cebf Merge "Fixed out of bound reads in stack variables" into lmp-dev 2017-05-12 20:45:19 +00:00
Wonsik Kim
4490398c88 Merge "DO NOT MERGE Check for cpb cnt in hrd parsing" into lmp-dev 2017-05-10 23:48:22 +00:00
Harish Mahendrakar
c9834edd64 Fixed out of bound reads in stack variables
Out of bound reads in the following variables are fixed

scaling_mat_offset in ihevcd_iquant_itrans_recon_ctb()
ai1_offset_y, ai1_offset_cb and ai1_offset_cr in ihevcd_sao_shift_ctb()

These values were read but not used

Bug: 34819017
Change-Id: Ic00e713b2c61d6793e1e097f852f0d1b3f913712
2017-05-09 14:28:47 -07:00
Hangyu Kuang
7e3858b313 Merge "Correct Tiles rows and cols check" into lmp-dev 2017-04-12 20:00:25 +00:00
TreeHugger Robot
397d2f6c42 Merge "Check only allocated mv bufs for releasing from reference" into lmp-dev 2017-04-12 19:49:50 +00:00
Naveen Kumar P
07ef4e7138 Correct Tiles rows and cols check
Bug: 36231493
Bug: 34064500
Change-Id: Ib17b2c68360685c5a2c019e1497612a130f9f76a
2017-04-11 14:12:29 -07:00
Ray Essick
bfcdbd6a5b Merge "Set current slice ctb x and y to fill prev incomplete slice" into lmp-dev 2017-04-10 22:46:39 +00:00
Naveen Kumar P
f9aea65f69 DO NOT MERGE Check for cpb cnt in hrd parsing
Bug: 34896431

The arrays in hrd are of size MAX_CPB_CNT. If cpb cnt is more
than MAX_CPB_CNT, more data is parsed and the subsequent buffer
is corrupted.

Change-Id: I74c01b8c7142b67a358eb5e36b160a7fbf2b69e4
2017-04-10 10:20:11 -07:00
Naveen Kumar P
830858436b Set current slice ctb x and y to fill prev incomplete slice
If previous slice is not completed, update the current slice
ctb_x and ctb_y so that while filling the previous slice,
the parse slice code can break properly.

Bug: 32322258
Test: boot, ran POC supplied with bug
Change-Id: Ie9090694514a018268851560a3f056194ff6fc91
2017-04-07 20:00:54 +00:00
Harish Mahendrakar
fed1a3d8d8 Fixed an out of bound read in accessing inverse scan table
Bug: 34819017
Change-Id: Ib25db1da92eee390a3847df06c0c0675ebcfb1a4
2017-03-22 10:06:35 -07:00
Naveen Kumar Ponnusamy
23bfe3e06d Check only allocated mv bufs for releasing from reference
When checking mv bufs for releasing from reference, unallocated
mv bufs were also checked. This issue was fixed by restricting
the loop count to allocated number of mv bufs.

Bug: 34896906
Bug: 34819017

Change-Id: If832f590b301f414d4cd5206414efc61a70c17cb
2017-03-15 18:13:38 +00:00
Marco Nelissen
fd5656fe76 Merge "Handle error return from ref list in slice hdr parsing" into lmp-dev 2017-03-13 23:53:33 +00:00
Naveen Kumar Ponnusamy
766f97657f Handle error return from ref list in slice hdr parsing
The error returned by ref_list function was not handled by the
caller parse_slice_header.

Bug: 34672748
Change-Id: I55f6cb0e651746e77f7ff3375115894ec3964203
2017-03-13 15:37:19 -07:00
TreeHugger Robot
09ff5c6298 Merge "Return error from cabac init if offset is greater than range" into lmp-dev 2017-03-13 22:31:34 +00:00
Naveen Kumar Ponnusamy
b92314c860 Return error from cabac init if offset is greater than range
When the offset was greater than range, the bitstream was read
more than the valid range in leaf-level cabac parsing modules.
Error check was added to cabac init to fix this issue. Additionally
end of slice and slice error were signalled to suppress further
parsing of current slice.

Bug: 34897036
Change-Id: I1263f1d1219684ffa6e952c76e5a08e9a933c9d2
(cherry picked from commit 3b175da88a1807d19cdd248b74bce60e57f05c6a)
2017-03-10 14:56:09 -08:00
Harish Mahendrakar
232bbe1908 Return error if SPS parsing reads more bytes than the nal length
Bug: 35039946

Change-Id: Ia97fa8711f313d0029d2b13e6d150d5e46b2bb99
(cherry picked from commit a6c58e18a49a1ea4929f8345b3c59f900d5813f5)
2017-03-03 11:22:24 -08:00
Marco Nelissen
98f9e26d24 Merge "Fix in handling wrong cu_qp_delta" into lmp-dev 2017-02-14 22:47:49 +00:00
Harish Mahendrakar
1ab5ce7e42 Handle invalid num_reorder_pics & max_dec_pic_buffering in SPS
Bug: 33864300
Change-Id: I920e45c3420a1a41a366ad45bd4186c5f6af6d6b
2017-02-13 20:21:01 +00:00
Harish Mahendrakar
01ca88bb6c Fix in handling wrong cu_qp_delta
cu_qp_delta is now checked for the range as specified in the spec
Bug: 33966031

Change-Id: I00420bf68081af92e9f2be9af7ce58d0683094ca
2017-02-13 20:18:51 +00:00
Ricardo Cerqueira
50ad42cf93 Fix the frame size alignments
Change I59c996161053e313c873381c5bf6f8c36488483f aligned the number
of luma samples to 64byte boundaries when calculating and creating
the buffers. Unfortunately, it doesn't change all instances of that
calculation, leading to mismatches between creation/allocation/destruction.

Fixes android.media.cts.DecoderTest#testEOSBehaviorHEVC and
android.media.cts.DecoderTest#testCodecEarlyEOSHEVC

Bug: 24686670
Bug: 25070493
Bug: 25995793
Bug: 26217939
Bug: 26239053

Change-Id: I5b9dd682e08cfb03d2bc54829c4908976251dee7
2015-12-17 16:27:54 +00:00
Harish Mahendrakar
b9f7c2c45c DO NOT MERGE Added few memsets to avoid uninitialized reads for error clips
Also aligned few allocations to 4 byte boundary

Bug: 25070493
Bug: 24686670
Change-Id: I59c996161053e313c873381c5bf6f8c36488483f
2015-11-06 12:12:01 -08:00
Marco Nelissen
552578a757 Revert "Added few memsets to avoid uninitialized reads for error clips"
This reverts commit d71abc6924.

Change-Id: I24ea5da7d00f9cd52ce8f64a0a5bce47df67216e
2015-11-06 19:22:31 +00:00