From ee29a07e1eb8be3dafc6ac62ef49f2d147d405cc Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Thu, 2 Nov 2017 15:28:09 -0700 Subject: ART: Fix OOME case in proxy dispatch Even just creating the java.lang.reflect.Method to pass to the handler may throw an exception. Add coverage to run-test 044. Bug: 68817306 Test: m test-art-host Change-Id: Iacf8fd679b9e8a81ff7bf7d5f6227e875ab10518 --- runtime/entrypoints/quick/quick_trampoline_entrypoints.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc index 4d7c2a1acb..a4a8c349a3 100644 --- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc @@ -961,9 +961,13 @@ extern "C" uint64_t artQuickProxyInvokeHandler( self->EndAssertNoThreadSuspension(old_cause); DCHECK_EQ(Runtime::Current()->GetClassLinker()->GetImagePointerSize(), kRuntimePointerSize); DCHECK(!Runtime::Current()->IsActiveTransaction()); - jobject interface_method_jobj = soa.AddLocalReference( - mirror::Method::CreateFromArtMethod(soa.Self(), - interface_method)); + ObjPtr interface_reflect_method = + mirror::Method::CreateFromArtMethod(soa.Self(), interface_method); + if (interface_reflect_method == nullptr) { + soa.Self()->AssertPendingOOMException(); + return 0; + } + jobject interface_method_jobj = soa.AddLocalReference(interface_reflect_method); // All naked Object*s should now be in jobjects, so its safe to go into the main invoke code // that performs allocations. -- cgit v1.2.3-59-g8ed1b