From 207a37dbb8049bdf585d17551c3eb3df685a629f Mon Sep 17 00:00:00 2001 From: Jeff Hao Date: Wed, 29 Oct 2014 17:24:25 -0700 Subject: Check null this pointer for direct methods in FindMethodFast. Also adds regression test 127-secondarydex. Bug: 18150997 (cherry picked from commit d2bee3dffa2f552512f47bca605ed857e3ae30ea) Change-Id: I911dd7c92c51939504cfee5a3d18a835987b8388 --- runtime/entrypoints/entrypoint_utils-inl.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'runtime/entrypoints/entrypoint_utils-inl.h') diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h index 670bf2aa8e..f76da8edaa 100644 --- a/runtime/entrypoints/entrypoint_utils-inl.h +++ b/runtime/entrypoints/entrypoint_utils-inl.h @@ -541,8 +541,7 @@ static inline mirror::ArtMethod* FindMethodFast(uint32_t method_idx, mirror::Object* this_object, mirror::ArtMethod* referrer, bool access_check, InvokeType type) { - bool is_direct = type == kStatic || type == kDirect; - if (UNLIKELY(this_object == NULL && !is_direct)) { + if (UNLIKELY(this_object == NULL && type != kStatic)) { return NULL; } mirror::ArtMethod* resolved_method = @@ -567,7 +566,7 @@ static inline mirror::ArtMethod* FindMethodFast(uint32_t method_idx, } if (type == kInterface) { // Most common form of slow path dispatch. return this_object->GetClass()->FindVirtualMethodForInterface(resolved_method); - } else if (is_direct) { + } else if (type == kStatic || type == kDirect) { return resolved_method; } else if (type == kSuper) { return referrer->GetDeclaringClass()->GetSuperClass() -- cgit v1.2.3-59-g8ed1b