diff options
author | 2023-10-11 12:56:19 +0100 | |
---|---|---|
committer | 2023-10-25 14:17:55 +0000 | |
commit | 876085b17f2bc5efe6b64eee4ddc1be4e967a4f1 (patch) | |
tree | 68c201c1990d300cba2324988c43ce7cfa80f4d4 /runtime/vdex_file.cc | |
parent | c13ae9cfc8883372637fb43d2c16b527cd2a5d2a (diff) |
Extend memory range of DexFileContainer passed to Dex loader.
Pass the whole relevant memory range (possibly including some
surrounding non-dex data).
If dex file shares data with other dex files, this will make
it possible to verify that all referred data is within bounds
of valid memory.
Test: ./art/test.py -b --host 001
Change-Id: I5e0058411db4baa3dbe74bfbd7c99d75c9afd694
Diffstat (limited to 'runtime/vdex_file.cc')
-rw-r--r-- | runtime/vdex_file.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/vdex_file.cc b/runtime/vdex_file.cc index ef4fb5e694..868e5e56bd 100644 --- a/runtime/vdex_file.cc +++ b/runtime/vdex_file.cc @@ -215,15 +215,16 @@ const uint8_t* VdexFile::GetNextTypeLookupTableData(const uint8_t* cursor, bool VdexFile::OpenAllDexFiles(std::vector<std::unique_ptr<const DexFile>>* dex_files, std::string* error_msg) const { size_t i = 0; + auto dex_file_container = std::make_shared<MemoryDexFileContainer>(Begin(), End()); for (const uint8_t* dex_file_start = GetNextDexFileData(nullptr, i); dex_file_start != nullptr; dex_file_start = GetNextDexFileData(dex_file_start, ++i)) { - size_t size = reinterpret_cast<const DexFile::Header*>(dex_file_start)->file_size_; // TODO: Supply the location information for a vdex file. static constexpr char kVdexLocation[] = ""; std::string location = DexFileLoader::GetMultiDexLocation(i, kVdexLocation); - ArtDexFileLoader dex_file_loader(dex_file_start, size, location); - std::unique_ptr<const DexFile> dex(dex_file_loader.Open(GetLocationChecksum(i), + ArtDexFileLoader dex_file_loader(dex_file_container, location); + std::unique_ptr<const DexFile> dex(dex_file_loader.Open(dex_file_start - Begin(), + GetLocationChecksum(i), /*oat_dex_file=*/nullptr, /*verify=*/false, /*verify_checksum=*/false, |