diff options
author | Andreas Gampe <agampe@google.com> | 2015-04-27 17:26:37 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2015-04-27 19:41:54 -0700 |
commit | 8208bddbefa9613422b9c6a19ce39a24391beec3 (patch) | |
tree | 618f6ca8791dcf0eaf659f751197f985a9bdec2b /runtime/native | |
parent | 97c96f5aab22f75dd54089bdc194588a4b5a2e8d (diff) | |
download | art-8208bddbefa9613422b9c6a19ce39a24391beec3.zip art-8208bddbefa9613422b9c6a19ce39a24391beec3.tar.gz art-8208bddbefa9613422b9c6a19ce39a24391beec3.tar.bz2 |
ART: Fix constructor access checking
Constructor access must be checked.
(cherry picked from commit 0dd76cd3f09f495a1b9a0e4f8712c09ff885c6fd)
Bug: 20639158
Change-Id: I3c586e9572a748d208bea43aa2349c3ef52a2ee5
Diffstat (limited to 'runtime/native')
-rw-r--r-- | runtime/native/java_lang_reflect_Constructor.cc | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/runtime/native/java_lang_reflect_Constructor.cc b/runtime/native/java_lang_reflect_Constructor.cc index 04d2e5e..810b354 100644 --- a/runtime/native/java_lang_reflect_Constructor.cc +++ b/runtime/native/java_lang_reflect_Constructor.cc @@ -30,10 +30,7 @@ namespace art { /* - * We get here through Constructor.newInstance(). The Constructor object - * would not be available if the constructor weren't public (per the - * definition of Class.getConstructor), so we can skip the method access - * check. We can also safely assume the constructor isn't associated + * We can also safely assume the constructor isn't associated * with an interface, array, or primitive class. If this is coming from * native, it is OK to avoid access checks since JNI does not enforce them. */ @@ -48,8 +45,8 @@ static jobject Constructor_newInstance(JNIEnv* env, jobject javaMethod, jobjectA PrettyDescriptor(c.Get()).c_str()); return nullptr; } - // Verify that we can access the class (only for debug since the above comment). - if (kIsDebugBuild && !c->IsPublic()) { + // Verify that we can access the class. + if (!c->IsPublic()) { auto* caller = GetCallingClass(soa.Self(), 1); // If caller is null, then we called from JNI, just avoid the check since JNI avoids most // access checks anyways. TODO: Investigate if this the correct behavior. |