diff options
author | 2025-01-16 15:25:07 +0000 | |
---|---|---|
committer | 2025-01-17 03:42:01 -0800 | |
commit | 984487963e3489cfe2fccb03479f7af11593d53f (patch) | |
tree | 4e66a0d7a4a75cb87fe20d4660d25587467bcbfa /runtime/entrypoints/entrypoint_utils-inl.h | |
parent | 861374be541184caefe37ce18b157feafae807ac (diff) |
Fix crash when calling a public Object method with invokesuper.
If the invokesuper is from a default method, fail the resolution as we
only expect interfaces in super calls from interface methods.
Test: 736-interface-super-Object
Change-Id: I7bd105cf1e441a9e575250db867678908b147477
Diffstat (limited to 'runtime/entrypoints/entrypoint_utils-inl.h')
-rw-r--r-- | runtime/entrypoints/entrypoint_utils-inl.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h index 7ddf06f5ab..f0f8f8dce3 100644 --- a/runtime/entrypoints/entrypoint_utils-inl.h +++ b/runtime/entrypoints/entrypoint_utils-inl.h @@ -632,6 +632,13 @@ ALWAYS_INLINE ArtMethod* FindSuperMethodToCall(uint32_t method_idx, } if (referenced_class->IsInterface()) { + if (!resolved_method->GetDeclaringClass()->IsInterface()) { + // invoke-super from interface should not resolve to Object methods. + DCHECK(resolved_method->GetDeclaringClass()->IsObjectClass()); + ThrowIncompatibleClassChangeError( + kSuper, resolved_method->GetInvokeType(), resolved_method, referrer); + return nullptr; + } // TODO We can do better than this for a (compiled) fastpath. ArtMethod* found_method = referenced_class->FindVirtualMethodForInterfaceSuper( resolved_method, linker->GetImagePointerSize()); |