Skip to content

Commit 095d914

Browse files
committed
bugfix verify reuse dexpc_ptr
Signed-off-by: Penguin. <chenguanyou9338@gmail.com>
1 parent 14c44b3 commit 095d914

File tree

1 file changed

+34
-14
lines changed

1 file changed

+34
-14
lines changed

parser/command/android/verify.cpp

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -214,21 +214,37 @@ uint64_t JavaVerify::FindSuperMethodToCall(art::ArtMethod& method, std::string n
214214
uint64_t result = 0;
215215
art::mirror::Class thiz = method.GetDeclaringClass();
216216
art::mirror::Class super = thiz.GetSuperClass();
217-
do {
218-
auto has_super_method = [&](art::ArtMethod& super_method) -> bool {
219-
std::string super_method_pretty;
220-
super_method_pretty.append(super_method.GetName());
221-
super_method_pretty.append(super_method.PrettyParameters());
222-
if (super_method_pretty == name) {
223-
result = super_method.Ptr();
224-
return true;
217+
218+
auto has_super_method = [&](art::ArtMethod& super_method) -> bool {
219+
std::string super_method_pretty;
220+
super_method_pretty.append(super_method.GetName());
221+
super_method_pretty.append(super_method.PrettyParameters());
222+
if (super_method_pretty == name) {
223+
result = super_method.Ptr();
224+
return true;
225+
}
226+
return false;
227+
};
228+
229+
if (!result) {
230+
art::mirror::IfTable& iftable = thiz.GetIfTable();
231+
int32_t ifcount = (iftable.Ptr() && iftable.IsValid()) ? iftable.Count() : 0;
232+
if (ifcount) {
233+
for (int i = 0; i < ifcount; ++i) {
234+
art::mirror::Class interface = iftable.GetInterface(i);
235+
Android::ForeachArtMethods(interface, has_super_method);
236+
if (result) break;
225237
}
226-
return false;
227-
};
228-
Android::ForeachArtMethods(super, has_super_method);
229-
if (result) break;
230-
super = super.GetSuperClass();
231-
} while (super.Ptr());
238+
}
239+
}
240+
241+
if (!result) {
242+
do {
243+
Android::ForeachArtMethods(super, has_super_method);
244+
if (result) break;
245+
super = super.GetSuperClass();
246+
} while (super.Ptr());
247+
}
232248
return result;
233249
}
234250

@@ -324,6 +340,10 @@ void JavaVerify::verifyMethods() {
324340
art::ArtMethod method = value;
325341
LOGI("[0x%" PRIx64 "] " ANSI_COLOR_LIGHTGREEN "%s" ANSI_COLOR_RESET "%s\n",
326342
method.Ptr(), art::PrettyMethodAccessFlags(method.access_flags()).c_str(), method.ColorPrettyMethod().c_str());
343+
for (auto& name : super_methods) {
344+
art::ArtMethod resolve_method = FindSuperMethodToCall(method, name);
345+
LOGI(" |--> invoke [0x%" PRIx64 "](%s)\n", resolve_method.Ptr(), resolve_method.ColorPrettyMethod().c_str());
346+
}
327347
}
328348
ENTER();
329349
}

0 commit comments

Comments
 (0)