diff options
author | 2023-08-01 17:21:12 +0100 | |
---|---|---|
committer | 2023-08-03 09:57:16 +0000 | |
commit | e644f39c976671bb8786db49a1c5de7795b87db1 (patch) | |
tree | 5c59c62648162c7781916fd68608b0ccd61a8d72 /runtime/class_loader_context.cc | |
parent | f4d1d5b9b1c3a91baf2c66030f7504fbd5498b28 (diff) |
Allow location duplicates when encoding class loader context
Bug: 293664704
Test: Run the app from the above bug
Test: m test-art-host-gtest-art_runtime_tests64
Change-Id: Ib2e3f0987c6cbc5f3cad1639a2259fc9882e0477
Diffstat (limited to 'runtime/class_loader_context.cc')
-rw-r--r-- | runtime/class_loader_context.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc index 6dc94fbd25..3bb7e426a1 100644 --- a/runtime/class_loader_context.cc +++ b/runtime/class_loader_context.cc @@ -699,22 +699,22 @@ void ClassLoaderContext::EncodeContextInternal(const ClassLoaderInfo& info, for (size_t k = 0; k < info.opened_dex_files.size();) { const std::unique_ptr<const DexFile>& dex_file = info.opened_dex_files[k]; uint32_t checksum = DexFileLoader::GetMultiDexChecksum(info.opened_dex_files, &k); + CHECK(!DexFileLoader::IsMultiDexLocation(dex_file->GetLocation().c_str())); if (for_dex2oat) { - // dex2oat only needs the base location. It cannot accept multidex locations. - // So ensure we only add each file once. - bool new_insert = - seen_locations.insert(DexFileLoader::GetBaseLocation(dex_file->GetLocation())).second; - CHECK(new_insert); + // De-duplicate locations. + bool new_insert = seen_locations.insert(dex_file->GetLocation()).second; + if (!new_insert) { + continue; + } } std::string location = dex_file->GetLocation(); // If there is a stored class loader remap, fix up the multidex strings. if (!remap.empty()) { - std::string base_dex_location = DexFileLoader::GetBaseLocation(location); - auto it = remap.find(base_dex_location); - CHECK(it != remap.end()) << base_dex_location; - location = it->second + DexFileLoader::GetMultiDexSuffix(location); + auto it = remap.find(location); + CHECK(it != remap.end()) << location; + location = it->second; } locations.emplace_back(std::move(location)); |