Commit Graph

638 Commits

Author SHA1 Message Date
Dario Freni
4ce4679309 androidfw changes to support /product-services.
See CL I7a6a30bf8e8db9f2738594d187bb9148f138b8da for a more detailed
description of the change.

Test: see CL I7a6a30bf8e8db9f2738594d187bb9148f138b8da description
Bug: 80741439
Change-Id: I6cc9d713c07c319fc2ee1c531af41243bd1d4aee
2018-08-17 16:34:18 +00:00
Todd Kennedy
c7d7611719 Merge "Loosen resource file verification" into pi-dev am: cf0b127110
am: 60413d0697

Change-Id: I95400ba3a885605bc52df10968ef2b4adf7f90a6
2018-07-16 14:31:10 -07:00
Todd Kennedy
60413d0697 Merge "Loosen resource file verification" into pi-dev
am: cf0b127110

Change-Id: I0b4012085579aa172a1a3f5a83325f0827523af5
2018-07-16 14:15:09 -07:00
Todd Kennedy
28e663cbed Loosen resource file verification
Bug: 77808145
Test: Tried to install corrupt APK prior to the change, install failed
Test: Tried to install corrupt APK after the change, install succeeded
Test: atest CtsAppSecurityHostTestCases:CorruptApkTests
Change-Id: I19a69e52a17c1080beaf2cc575c32f564b1033a3
2018-07-16 20:52:55 +00:00
Ryan Mitchell
426f8d2db8 Merge "Fix DynamicRefTable::load security bug" into oc-mr1-dev am: 2b6805fedc am: 5ae85666ac
am: 6899839e07

Change-Id: I3920ae30c0fdd5ef5b1176476d769abb269d5844
2018-06-06 16:43:03 -07:00
Ryan Mitchell
6899839e07 Merge "Fix DynamicRefTable::load security bug" into oc-mr1-dev am: 2b6805fedc
am: 5ae85666ac

Change-Id: I64521a290482adb5ade95b641ce9c0c27031a814
2018-06-06 16:09:35 -07:00
Ryan Mitchell
5ae85666ac Merge "Fix DynamicRefTable::load security bug" into oc-mr1-dev
am: 2b6805fedc

Change-Id: I5ef0a789b16dc8aa0936d8fcca3917ce2f884d74
2018-06-06 15:50:57 -07:00
Ryan Mitchell
18a6ada4aa Fix DynamicRefTable::load security bug
DynamicRefTables parsed from apks are missing bounds checks that prevent
buffer overflows. This changes verifies the bounds of the header before
attempting to preform operations on the chunk.

Bug: 79488511
Test: run cts -m CtsAppSecurityHostTestCases \
        -t android.appsecurity.cts.CorruptApkTests

Change-Id: I02c8ad957da244fce777ac68a482e4e8fa70f846
Merged-In: I02c8ad957da244fce777ac68a482e4e8fa70f846
2018-06-05 22:05:11 +00:00
Ryan Mitchell
65bed52d7d Merge "ResStringPool: Prevenet boot loop from se fix" into pi-dev am: 8dd9ef190b
am: 9964297b44

Change-Id: Ib041932219d47504743fe82dc4a7f77ac1d9f630
2018-05-22 14:27:58 -07:00
Ryan Mitchell
9964297b44 Merge "ResStringPool: Prevenet boot loop from se fix" into pi-dev
am: 8dd9ef190b

Change-Id: I0000c4a3f06e002804aa7172505e07bb57c550c6
2018-05-22 14:16:13 -07:00
Ryan Mitchell
f05f47b2c1 ResStringPool: Prevenet boot loop from se fix
Changes the logs adding in a previous security fix to warnings so
devices with malformed APKs currently on them will not undergo DOS when
they are upgraded to P.

Bug: 79724567
Test: run cts -m CtsAppSecurityHostTestCases \
          -t android.appsecurity.cts.CorruptApkTests

Change-Id: Ied54e4bb14abdaf79da562022c7ea6075187c1f8
2018-05-21 13:59:23 -07:00
Ryan Mitchell
d692b8665e Merge "ResXMLTree: Clone DynamicRefTable on creation" into pi-dev am: fd37ec90b8
am: b3da3a9673

Change-Id: Ic715bc6db56328c47da4a30a3e46ea92bbf10f92
2018-05-21 12:06:13 -07:00
Ryan Mitchell
b3da3a9673 Merge "ResXMLTree: Clone DynamicRefTable on creation" into pi-dev
am: fd37ec90b8

Change-Id: I3030d62104142b33dfb9844faa2fcb9840d8ee61
2018-05-21 11:53:56 -07:00
Dan Willemsen
f97d380ca7 Merge "Convert to Soong" am: acbd94d76f am: b1005a8a2a
am: d00c851e55

Change-Id: I889b5d31535d927b3aa9cf5ad6af955ca0678356
2018-05-15 15:52:51 -07:00
Ryan Mitchell
a41e66af58 ResXMLTree: Clone DynamicRefTable on creation
XmlBlocks are cached in ResourcesImpl::loadXmlResourceParser(...) and
when asset manager invalidates itself, the references to the dynamic
reference tables point to garbage. Now, the reference table is cloned
when the XmlBlock is created so invalidation will not affect the
XmlTree.

Bug: 74240254
Test: Tested GoogleMaps on 9.75.7 and saw crashes stop
Change-Id: I932db7a85fddc640c4d6ec327f534b5a1ad6d0b1
2018-05-15 15:08:58 -07:00
Dan Willemsen
d00c851e55 Merge "Convert to Soong" am: acbd94d76f
am: b1005a8a2a

Change-Id: If5cb26e0669f79240d8fee1d40aaa2162d8e611f
2018-05-15 15:06:19 -07:00
Dan Willemsen
4888b1f6f0 Convert to Soong
See build/soong/README.md for more information.

Test: m libframeworks_coretests_jni
Test: m FrameworkCoreTests_install
Test: m libshim_jni
Test: m CtsShimPrivUpgrade
Test: m libfilterfw
Test: m PMTest_Java_dual
Test: m libdefcontainer_jni
Test: m libperftestscore_jni
Test: m libpmtest32 libpmtest64
Test: m libprintspooler_jni
Test: m libsmartcamera_jni
Test: m idmap
Test: m libdrmframework_jni
Test: m libdvr_loader com.google.vr.platform com.google.vr.platform.xml
Test: m libfilterpack_imageproc libfilterpack_base
Test: m libwebviewchromium_loader
Test: m shared_mem_test
Test: m test-touchlag
Change-Id: I868561dd237fa28647896d59049ab9260373ada1
2018-05-14 16:47:02 -07:00
Ryan Mitchell
96930e4faa Merge "AAPT: Fixed split resource dumping" into pi-dev am: fb07d82086
am: d94160943d

Change-Id: Idfef5422bbe3a3e46ceb1951e6393d2c80852930
2018-05-08 11:01:37 -07:00
Ryan Mitchell
d94160943d Merge "AAPT: Fixed split resource dumping" into pi-dev
am: fb07d82086

Change-Id: I66dedae28679c07e0bfa76cfafba97d563356fcb
2018-05-08 10:28:36 -07:00
Ryan Mitchell
30487e0a79 AAPT: Fixed split resource dumping
AAPT would not print resource values for splits passed in with the -I
flag. This fix prints out each split separately with the correct type
specs and values.

Bug: 79195967
Test: aapt dump --values -I base-hdpi.apk resources base-master.apk
Change-Id: I223186136e98180fec4a3d96f92f53407db59e2d
2018-05-07 15:36:44 -07:00
Anton Hansson
b365836d8e Merge "frameworks/base: Update a few more references to android.jar." am: 85e68063a9 am: 52e98e1b7a
am: 0f185f8b19

Change-Id: I84aebb1697c0217ea9063a2c6b71e8d4a3c6b1a7
2018-05-02 14:17:26 -07:00
Anton Hansson
0f185f8b19 Merge "frameworks/base: Update a few more references to android.jar." am: 85e68063a9
am: 52e98e1b7a

Change-Id: Iffb2389f8ef3dcca139a99a617c2079910f3c902
2018-05-02 10:24:32 -07:00
Anton Hansson
0c70390040 frameworks/base: Update a few more references to android.jar.
These files are moving. Update the paths so that the old files can be
deleted.

Bug: 77525052
Test: ./build for one of these scripts
Change-Id: Iacca1f1930d6a2614866f6503a2b4c1eba4d4018
2018-05-01 18:34:10 +01:00
Todd Kennedy
0a81745b48 Merge "Allow using reserved package IDs" into pi-dev am: 13588dc9e4
am: c323122e93

Change-Id: I0addf146d9519a93bc2f8f73898a3454cb1cfb56
2018-04-26 15:27:00 -07:00
Todd Kennedy
325129964e Allow using reserved package IDs
Pre-O, the platform treats negative resource IDs [those with
a package ID of 0x80 or higher] as invalid.  In order to work
around this limitation, we allow the use of traditionally
reserved resource IDs [those between 0x02 and 0x7E].

Bug: 78041707
Test: ./out/host/linux-x86/nativetest64/aapt2_tests/aapt2_tests
Test: ./out/host/linux-x86/nativetest/libandroidfw_tests/libandroidfw_tests
Test: Manual. Create a feature split with a package ID of 0x7E and see it runs and can reference base resources.

Change-Id: I3d9782cc05d3a55e1a2467bf39566788847e1160
2018-04-26 10:27:30 -07:00
Ryan Mitchell
027453d6fb Merge "AAPT2: Support id reference chaining from AAPT" into pi-dev am: 247ecfa498
am: e9bbefa7dc

Change-Id: Ic40b9e08352e561e21284d72592860b868f6edc1
2018-04-19 15:20:51 -07:00
y
9efbbef2e0 AAPT2: Support id reference chaining from AAPT
AAPT would allow for ids to be declared in the form:

<item name="name" type="id>@id/other</item>

@id/name should hold a reference to @id/other. When
getResources().getValue() is called on R.id.name with resolveRefs
enabled, the resuling reference should be R.id.other.

Bug: 69445910
Test: Created tests for correct parsing of id references and correct
resolving of deep references

Change-Id: Id1feb37b2565c213dc6a19b4c401906260d7fc14
2018-04-18 11:46:53 -07:00
y
5604680766 [automerger] ResStringPool: Fix security vulnerability am: 7e54c3f261 am: 98e2d2ec50 am: 24a89da344 am: d85632ae40 am: 927b3357fa am: 79d0fb2530 am: a509e771ba am: 80e36faa72 am: 76d71fa910 am: 86cfcaa610
am: 4f5e234020

Change-Id: Iedf59329ed35149cec2143e8f179c7912534a41d
2018-04-13 14:08:07 -07:00
y
4f5e234020 [automerger] ResStringPool: Fix security vulnerability am: 7e54c3f261 am: 98e2d2ec50 am: 24a89da344 am: d85632ae40 am: 927b3357fa am: 79d0fb2530 am: a509e771ba am: 80e36faa72 am: 76d71fa910
am: 86cfcaa610

Change-Id: I6d37d24fd14271d24595c380ea553cb37948fa9e
2018-04-13 13:57:36 -07:00
Android Build Merger (Role)
86cfcaa610 [automerger] ResStringPool: Fix security vulnerability am: 7e54c3f261 am: 98e2d2ec50 am: 24a89da344 am: d85632ae40 am: 927b3357fa am: 79d0fb2530 am: a509e771ba am: 80e36faa72 am: 76d71fa910
Change-Id: I971b589190cae708a08dd568290807dff0f75349
2018-04-13 20:35:02 +00:00
Android Build Merger (Role)
76d71fa910 [automerger] ResStringPool: Fix security vulnerability am: 7e54c3f261 am: 98e2d2ec50 am: 24a89da344 am: d85632ae40 am: 927b3357fa am: 79d0fb2530 am: a509e771ba am: 80e36faa72
Change-Id: Ibeb5d99f477048e8715a0d4b093052f3d88445e2
2018-04-13 20:34:58 +00:00
Android Build Merger (Role)
80e36faa72 [automerger] ResStringPool: Fix security vulnerability am: 7e54c3f261 am: 98e2d2ec50 am: 24a89da344 am: d85632ae40 am: 927b3357fa am: 79d0fb2530 am: a509e771ba
Change-Id: I48bf9619571a30e6f5ea5bad503a3805e0821a75
2018-04-13 20:34:53 +00:00
Android Build Merger (Role)
a509e771ba [automerger] ResStringPool: Fix security vulnerability am: 7e54c3f261 am: 98e2d2ec50 am: 24a89da344 am: d85632ae40 am: 927b3357fa am: 79d0fb2530
Change-Id: I068f51adbb0248db232c50bd89fb25ef0d7273a9
2018-04-13 20:34:49 +00:00
Android Build Merger (Role)
927b3357fa [automerger] ResStringPool: Fix security vulnerability am: 7e54c3f261 am: 98e2d2ec50 am: 24a89da344 am: d85632ae40
Change-Id: I24a1df41eb29a6ac7e6c67368f07c6702dacf071
2018-04-13 20:34:34 +00:00
y
7e54c3f261 ResStringPool: Fix security vulnerability
Adds detection of attacker-modified size and data fields passed to
ResStringPool::setTo(). These attacks are modified apks that AAPT would
not normally generate. In the rare case this occurs, the installation
cannot be allowed to continue.

Bug: 71361168
Bug: 71360999
Test: run cts -m CtsAppSecurityHostTestCases \
          -t android.appsecurity.cts.CorruptApkTests

Change-Id: If7eb93a9e723b16c8a0556fc4e20006aa0391d57
Merged-In: If7eb93a9e723b16c8a0556fc4e20006aa0391d57
2018-04-13 20:34:18 +00:00
Ryan Mitchell
780453ac02 Merge "AAPT2: GetBag infinite recursion fix" into pi-dev am: 3ddd801449
am: 7b13ad69ec

Change-Id: I0fa176974242707aecd6d0d593670e13c0a9012d
2018-04-13 11:59:02 -07:00
y
57cd195c43 AAPT2: GetBag infinite recursion fix
Style resources with circular parental dependencies caused infinite
recursion when calling AssetManager2::GetBag. This fix allows recursion
to cease when a circular dependency is found.

Bug: 77928512
Change-Id: Ib900c36ab1aef5da5b03234a9484c4dad3b63c02
Test: Manual test of b/77928512 and duplicates of 74493983
2018-04-13 08:50:09 -07:00
Ryan Mitchell
91706bee7b Merge "ResStringPool: Fix security vulnerability" into pi-dev am: 135d82ac45
am: 097ba79da7

Change-Id: I078117c08fdc713a40a52b1f3b07504593cc3c69
2018-04-09 18:56:53 -07:00
y
e46df9d47e ResStringPool: Fix security vulnerability
Adds detection of attacker-modified size and data fields passed to
ResStringPool::setTo(). These attacks are modified apks that AAPT would
not normally generate. In the rare case this occurs, the installation
cannot be allowed to continue.

Bug: 71361168
Bug: 71360999
Test: run cts -m CtsAppSecurityHostTestCases \
          -t android.appsecurity.cts.CorruptApkTests
Change-Id: If7eb93a9e723b16c8a0556fc4e20006aa0391d57
2018-04-06 18:12:42 +00:00
Ryan Mitchell
49668cd130 Merge "Added decoding of truncated AAPT string lengths." into pi-dev 2018-04-04 21:21:10 +00:00
Ryan Mitchell
2ad530d76c Added decoding of truncated AAPT string lengths.
AAPT incorrectly writes a truncated string length when the string size
exceeded the maximum possible encode length value (0x7FFF). To decode a
truncated length, this change iterates through length values that end
in the encode length bits. Strings that exceed the maximum encode length
are not placed into StringPools in AAPT2.

Test: Successfully ran broken apps from the duplicates of the bugs
provided and created tests
Bug: 69320870

Change-Id: I99dd9b63e91ac250f81d5dfc26b7c0e6276ae162
(cherry picked from commit ea9e8b447a)
2018-04-04 15:56:11 +00:00
Ryan Mitchell
6759955c95 Fixed resource bag retrieval infinite recursion.
An app was crashing because in an attempt to retrieve layout
attribute/style data, the app infinitely recursed because its parent was
set to itself. This change checks if the resource bag parent and child
have the same ids, and if so, attempts to find the resource in this bag
alone rather than attempting to also look in parent bags.

Bug: 74493983
Test: Manual testing of Fitbit app
Change-Id: Iea37533a0676bd51b72c9bb235adec9bd04f2ccc
(cherry picked from commit ac04095ba9)
2018-04-04 15:55:34 +00:00
TreeHugger Robot
00d439f9dc Merge "Added decoding of truncated AAPT string lengths." 2018-04-02 20:36:43 +00:00
Ryan Mitchell
ea9e8b447a Added decoding of truncated AAPT string lengths.
AAPT incorrectly writes a truncated string length when the string size
exceeded the maximum possible encode length value (0x7FFF). To decode a
truncated length, this change iterates through length values that end
in the encode length bits. Strings that exceed the maximum encode length
are not placed into StringPools in AAPT2.

Test: Successfully ran broken apps from the duplicates of the bugs
provided and created tests
Bug: 69320870

Change-Id: I99dd9b63e91ac250f81d5dfc26b7c0e6276ae162
2018-04-02 12:20:14 -07:00
Ryan Mitchell
ac04095ba9 Fixed resource bag retrieval infinite recursion.
An app was crashing because in an attempt to retrieve layout
attribute/style data, the app infinitely recursed because its parent was
set to itself. This change checks if the resource bag parent and child
have the same ids, and if so, attempts to find the resource in this bag
alone rather than attempting to also look in parent bags.

Bug: 74493983
Test: Manual testing of Fitbit app
Change-Id: Iea37533a0676bd51b72c9bb235adec9bd04f2ccc
2018-03-30 16:13:53 -07:00
Svet Ganov
a43e1882e0 Merge "Fix resource by name lookup" into pi-dev am: 909402935c
am: 404231b3bf

Change-Id: I25bb90f1b150a2bac45ea8a8ccbb3604cfdc31e9
2018-03-23 19:22:04 +00:00
Svet Ganov
3f08542208 Fix resource by name lookup
Test: added: '@' cases to ResourceUtilsTest
      pass: ./out/host/darwin-x86/nativetest/libandroidfw_tests/libandroidfw_tests
      pass: ./out/host/darwin-x86/nativetest/aapt2_tests/aapt2_tests
      pass: cts-tradefed run cts-dev -m CtsAppSecurityHostTestCases
                -t android.appsecurity.cts.PermissionsHostTest

Bug: 74612500

Change-Id: I144e4ca1b63b9cce71052fc02089bb6092739889
2018-03-22 20:59:05 -07:00
TreeHugger Robot
0315c8495d Merge "Don't dereference a null pointer" 2018-03-05 18:58:43 +00:00
Adam Lesinski
f3c951fd52 Merge "Change ownership of AAPT2 and libandroidfw" 2018-03-02 22:38:46 +00:00
Todd Kennedy
949b625377 Don't dereference a null pointer
If we don't specifiy an output for R.java, don't try to write
data to the class definition

Change-Id: I3ad471ec93dcb8baf13f221174065679cce311ad
Fixes: 72547268
Test: out/host/linux-x86/nativetest64/aapt2_tests/aapt2_tests
2018-03-02 14:19:45 -08:00