Michael Wachenschwanz d53a5c4aa9 Disallow reading object data from Parcels with non-object reads
The check added to each non-object reads adds an overhead. If the
objects (binders and file descriptors) were written to the Parcel in
sequential order then check adds a small O(1) overhead to each read,
plus an O(N) overhead to the first read (to verify the N objects were
added in order).
If the objects were written out of order (as in by jumping around the
with setDataPosition and writing Binder, DON'T DO THIS!!) (writing non
objects out of order is fine), the first read is forced to sort the
in the internal bookkeeping. Based on the assumption non sequential
are infrequent and overall Parcels are probably mostly sorted, insertion
sort was used. Worst case sorts will add an O(N^2) overhead to the first
non object read from the Parcel.

Test: run cts -m CtsOsTestCases -t android.os.cts.ParcelTest

Bug: 29833520
Change-Id: I82de8eb5f5eb56f869542d5358e96884c24301b2
(cherry picked from commit c517681c66a1a387be657e0cf06da8d19659dd14)
2018-07-16 20:31:22 +02:00
android Android 6.0.1 release 22 2016-03-10 18:17:45 -08:00
batteryservice Android 6.0.0 release 26 2015-11-05 01:41:42 +00:00
binder Disallow reading object data from Parcels with non-object reads 2018-07-16 20:31:22 +02:00
diskusage More changes to fix PDK build: 2012-10-24 12:30:41 -07:00
gui Revert "Revert "gui: only support tertiary display if QTI_BSP is defined"" 2016-01-09 17:50:43 -08:00
input Android 6.0.1 release 46 2016-06-07 10:10:09 -07:00
media OMX: clarify EOS signaling for tunneled decoders 2015-08-07 10:10:31 -07:00
powermanager Make IPowerManager native conform to .aidl for oneway 2014-09-05 17:12:24 -07:00
private SurfaceFlinger: Native changes to add blur effect 2015-11-08 01:07:13 -08:00
ui Android 6.0.1 Release 61 (MOB30Z) 2016-08-02 11:37:44 -07:00