summaryrefslogtreecommitdiff
path: root/runtime/oat_file_assistant.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2018-12-21 16:38:47 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2019-01-16 13:51:03 +0000
commitf3d88a8a16245f4561ea7e920f1f84690a07411c (patch)
treef4fe7356dd22404a7f1b663f30970e318d7b3d5d /runtime/oat_file_assistant.cc
parentc7d1ef1d424e632d2fcfdfef35d6c694e29adb09 (diff)
Support oat files compiled with partial boot class path.
Test: oat_file_assistant_test Bug: 119868597 Bug: 122937705 Change-Id: I07c59957983c0ec61ade5215bb83c41e7cb4b672
Diffstat (limited to 'runtime/oat_file_assistant.cc')
-rw-r--r--runtime/oat_file_assistant.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index 8b81bb9bfc..80ac01f41a 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -563,8 +563,17 @@ const std::vector<uint32_t>* OatFileAssistant::GetRequiredDexChecksums() {
bool OatFileAssistant::ImageInfo::ValidateBootClassPathChecksums(const OatFile& oat_file) const {
const char* oat_boot_class_path_checksums =
oat_file.GetOatHeader().GetStoreValueByKey(OatHeader::kBootClassPathChecksumsKey);
- return oat_boot_class_path_checksums != nullptr &&
- oat_boot_class_path_checksums == boot_class_path_checksums;
+ if (oat_boot_class_path_checksums == nullptr) {
+ return false;
+ }
+ // The checksums can be either the same or a prefix of the expected checksums,
+ // ending before the ':' delimiter.
+ size_t length = strlen(oat_boot_class_path_checksums);
+ if (length > boot_class_path_checksums.length() ||
+ (length < boot_class_path_checksums.length() && boot_class_path_checksums[length] != ':')) {
+ return false;
+ }
+ return boot_class_path_checksums.compare(0u, length, oat_boot_class_path_checksums) == 0;
}
std::unique_ptr<OatFileAssistant::ImageInfo>