Fix use of std::stoi without error handling.
Changed to use strtoul, with a break if it fails to read the checksum.
Test: mm test-art-host
Bug: 32066687
Change-Id: Ic1299c23aae15a8329ad57b4eca5c0857f6eefb6
diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc
index 651a6ee..5641459 100644
--- a/runtime/oat_file_manager.cc
+++ b/runtime/oat_file_manager.cc
@@ -403,9 +403,13 @@
DexFileAndClassPair pair(temp.top());
const DexFile* dex_file = pair.GetDexFile();
const std::string& dex_filename = dex_file->GetLocation();
+ if (dex_filename != shared_libraries_split[index]) {
+ break;
+ }
+ char* end;
+ size_t shared_lib_checksum = strtoul(shared_libraries_split[index + 1].c_str(), &end, 10);
uint32_t dex_checksum = dex_file->GetLocationChecksum();
- if (dex_filename != shared_libraries_split[index] ||
- dex_checksum != std::stoul(shared_libraries_split[index + 1])) {
+ if (*end != '\0' || dex_checksum != shared_lib_checksum) {
break;
}
temp.pop();