diff options
author | Vladimir Marko <vmarko@google.com> | 2014-06-12 15:22:31 +0100 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2014-06-12 18:08:44 +0100 |
commit | 3bd7a6c1716935e758f230e2f199128cb3c28b42 (patch) | |
tree | fda9d595f8ee976fcb309b94abebcd859db76d02 /runtime | |
parent | dfc2091d2fb8a7694f69acf8bd39ce4953e026c2 (diff) | |
download | art-3bd7a6c1716935e758f230e2f199128cb3c28b42.tar.gz art-3bd7a6c1716935e758f230e2f199128cb3c28b42.tar.bz2 art-3bd7a6c1716935e758f230e2f199128cb3c28b42.zip |
Fix reflection access check for attached native threads.
Bug: 15539150
Change-Id: Ie580cad1c0169d550162bcc878b07643259323c4
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/reflection.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/reflection.cc b/runtime/reflection.cc index 89cdb4dc7e..fe5e1043a9 100644 --- a/runtime/reflection.cc +++ b/runtime/reflection.cc @@ -815,6 +815,10 @@ bool UnboxPrimitiveForResult(const ThrowLocation& throw_location, mirror::Object bool VerifyAccess(mirror::Object* obj, mirror::Class* declaring_class, uint32_t access_flags) { NthCallerVisitor visitor(Thread::Current(), 2); visitor.WalkStack(); + if (UNLIKELY(visitor.caller == nullptr)) { + // The caller is an attached native thread. + return (access_flags & kAccPublic) != 0; + } mirror::Class* caller_class = visitor.caller->GetDeclaringClass(); if (((access_flags & kAccPublic) != 0) || (caller_class == declaring_class)) { |