diff options
| author | 2017-03-03 13:50:21 -0800 | |
|---|---|---|
| committer | 2017-03-03 14:01:09 -0800 | |
| commit | 136fd0764faf7a588b4a1b479d7a8cc6fe18fcc6 (patch) | |
| tree | 91f7316861e5d879a627bd00578170791889c528 /libs/androidfw/LoadedArsc.cpp | |
| parent | 485c0feea53199b1d43db8782073044c846424c4 (diff) | |
AAPT2: Fix parsing ResTable_type
ResTable_type's size changes due to it containing
ResTable_config. Make sure we check for the minimum size
required to read it.
Bug: 35861796
Test: Manual (don't have an integration test harness setup yet)
Change-Id: Ifb0cd1d732625f59835c8ed0449adb78129636de
Diffstat (limited to 'libs/androidfw/LoadedArsc.cpp')
| -rw-r--r-- | libs/androidfw/LoadedArsc.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/androidfw/LoadedArsc.cpp b/libs/androidfw/LoadedArsc.cpp index db72f487d52b..621d8c0e96f0 100644 --- a/libs/androidfw/LoadedArsc.cpp +++ b/libs/androidfw/LoadedArsc.cpp @@ -212,7 +212,7 @@ const LoadedPackage* LoadedArsc::GetPackageForId(uint32_t resid) const { static bool VerifyType(const Chunk& chunk) { ATRACE_CALL(); - const ResTable_type* header = chunk.header<ResTable_type>(); + const ResTable_type* header = chunk.header<ResTable_type, kResTableTypeMinSize>(); const size_t entry_count = dtohl(header->entryCount); if (entry_count > std::numeric_limits<uint16_t>::max()) { @@ -533,7 +533,7 @@ std::unique_ptr<LoadedPackage> LoadedPackage::Load(const Chunk& chunk) { } break; case RES_TABLE_TYPE_TYPE: { - const ResTable_type* type = child_chunk.header<ResTable_type>(); + const ResTable_type* type = child_chunk.header<ResTable_type, kResTableTypeMinSize>(); if (type == nullptr) { LOG(ERROR) << "Chunk RES_TABLE_TYPE_TYPE is too small."; return {}; |