summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2014-06-12 17:15:23 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-06-10 21:26:11 +0000
commit5110a876ce7aa1479bcbeabc76403e8b5fbe75d5 (patch)
tree2d23285ec308b945a226a92d5510e7422fb68279 /runtime
parenta194acf232b761b2ead114bdc6c38af112bf08cd (diff)
parent3bd7a6c1716935e758f230e2f199128cb3c28b42 (diff)
downloadart-5110a876ce7aa1479bcbeabc76403e8b5fbe75d5.zip
art-5110a876ce7aa1479bcbeabc76403e8b5fbe75d5.tar.gz
art-5110a876ce7aa1479bcbeabc76403e8b5fbe75d5.tar.bz2
Merge "Fix reflection access check for attached native threads."
Diffstat (limited to 'runtime')
-rw-r--r--runtime/reflection.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/reflection.cc b/runtime/reflection.cc
index 89cdb4d..fe5e104 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)) {