Fix unquickening in the presence of duplicate methods.
The code item may have already been unquicken.
bug: 36059948
Test: 649-vdex-duplicate-method
Change-Id: Icd4d9397ca11cb99cfbeffca658115f51db4a1b3
diff --git a/runtime/dex_to_dex_decompiler.cc b/runtime/dex_to_dex_decompiler.cc
index 85d5784..c15c9ec 100644
--- a/runtime/dex_to_dex_decompiler.cc
+++ b/runtime/dex_to_dex_decompiler.cc
@@ -32,6 +32,7 @@
bool decompile_return_instruction)
: code_item_(code_item),
quickened_info_ptr_(quickened_info.data()),
+ quickened_info_start_(quickened_info.data()),
quickened_info_end_(quickened_info.data() + quickened_info.size()),
decompile_return_instruction_(decompile_return_instruction) {}
@@ -89,6 +90,7 @@
const DexFile::CodeItem& code_item_;
const uint8_t* quickened_info_ptr_;
+ const uint8_t* const quickened_info_start_;
const uint8_t* const quickened_info_end_;
const bool decompile_return_instruction_;
@@ -185,10 +187,15 @@
}
if (quickened_info_ptr_ != quickened_info_end_) {
- LOG(FATAL) << "Failed to use all values in quickening info."
- << " Actual: " << std::hex << quickened_info_ptr_
- << " Expected: " << quickened_info_end_;
- return false;
+ if (quickened_info_start_ == quickened_info_ptr_) {
+ LOG(WARNING) << "Failed to use any value in quickening info,"
+ << " potentially due to duplicate methods.";
+ } else {
+ LOG(FATAL) << "Failed to use all values in quickening info."
+ << " Actual: " << std::hex << reinterpret_cast<uintptr_t>(quickened_info_ptr_)
+ << " Expected: " << reinterpret_cast<uintptr_t>(quickened_info_end_);
+ return false;
+ }
}
return true;