diff options
author | Mathieu Chartier <mathieuc@google.com> | 2015-03-29 18:27:50 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2015-03-29 18:54:20 -0700 |
commit | ca239af73e512df5eeb80fe6c09c2ca614649e06 (patch) | |
tree | cee8641c42385f40b567c686cd5053fde152a088 /runtime/reflection.cc | |
parent | f381645a336f7092ab6f5900c0a2cf183a9dbdf7 (diff) | |
download | art-ca239af73e512df5eeb80fe6c09c2ca614649e06.tar.gz art-ca239af73e512df5eeb80fe6c09c2ca614649e06.tar.bz2 art-ca239af73e512df5eeb80fe6c09c2ca614649e06.zip |
Fix some reflection errors
Fixed incorrectly using 2nd frame instead of 1st in VerifyAccess.
Added regression test to ART. Fixed broken setShort,
getDeclaredFieldInternal.
Change-Id: I4b21d52d998cb768fe9503b8bccec506b7b972e5
Diffstat (limited to 'runtime/reflection.cc')
-rw-r--r-- | runtime/reflection.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/reflection.cc b/runtime/reflection.cc index d845e402e7..4e94de4139 100644 --- a/runtime/reflection.cc +++ b/runtime/reflection.cc @@ -587,7 +587,7 @@ jobject InvokeMethod(const ScopedObjectAccessAlreadyRunnable& soa, jobject javaM // If method is not set to be accessible, verify it can be accessed by the caller. mirror::Class* calling_class = nullptr; if (!accessible && !VerifyAccess(soa.Self(), receiver, declaring_class, m->GetAccessFlags(), - &calling_class)) { + &calling_class, 2)) { ThrowIllegalAccessException( StringPrintf("Class %s cannot access %s method %s of class %s", calling_class == nullptr ? "null" : PrettyClass(calling_class).c_str(), @@ -794,11 +794,11 @@ bool UnboxPrimitiveForResult(mirror::Object* o, } bool VerifyAccess(Thread* self, mirror::Object* obj, mirror::Class* declaring_class, - uint32_t access_flags, mirror::Class** calling_class) { + uint32_t access_flags, mirror::Class** calling_class, size_t num_frames) { if ((access_flags & kAccPublic) != 0) { return true; } - NthCallerVisitor visitor(self, 2); + NthCallerVisitor visitor(self, num_frames); visitor.WalkStack(); if (UNLIKELY(visitor.caller == nullptr)) { // The caller is an attached native thread. |