diff options
Diffstat (limited to 'runtime/oat_file_assistant.cc')
| -rw-r--r-- | runtime/oat_file_assistant.cc | 13 |
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> |