summaryrefslogtreecommitdiff
path: root/runtime/jni/check_jni.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2025-06-11 14:48:25 +0100
committer Kampalus <kampalus@protonmail.ch> 2025-09-18 09:53:00 +0200
commit46bbaa3be86e01aca8d6f34c89cc90a6333fcf96 (patch)
tree37c25b0d82a0e5b7ce186857fa8531112dc868aa /runtime/jni/check_jni.cc
parented6c006bd06ae060bd9698fd2cb25c4865512ec3 (diff)
[SP 2025-09-01] Throw an exception in JNI::NewObject for abstract classes.banksia-dev
Test: 863-serialization Bug: 421834866 Flag: EXEMPT bugfix (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a4826745b63bdab1db7536680e1c8e947a56f7be) Merged-In: I4ccf22f85b4ae0325e9f8e29503149bbda533e86 Change-Id: I4ccf22f85b4ae0325e9f8e29503149bbda533e86
Diffstat (limited to 'runtime/jni/check_jni.cc')
-rw-r--r--runtime/jni/check_jni.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/jni/check_jni.cc b/runtime/jni/check_jni.cc
index a05a3e97f2..24e3256d81 100644
--- a/runtime/jni/check_jni.cc
+++ b/runtime/jni/check_jni.cc
@@ -747,10 +747,10 @@ class ScopedCheck {
return true;
}
- bool CheckInstantiableNonArray(ScopedObjectAccess& soa, jclass jc)
+ bool CheckNonArray(ScopedObjectAccess& soa, jclass jc)
REQUIRES_SHARED(Locks::mutator_lock_) {
ObjPtr<mirror::Class> c = soa.Decode<mirror::Class>(jc);
- if (!c->IsInstantiableNonArray()) {
+ if (c->IsArrayClass()) {
AbortF("can't make objects of type %s: %p", c->PrettyDescriptor().c_str(), c.Ptr());
return false;
}
@@ -2195,7 +2195,7 @@ class CheckJNI {
ScopedObjectAccess soa(env);
ScopedCheck sc(kFlag_Default, __FUNCTION__);
JniValueType args[2] = {{.E = env}, {.c = c}};
- if (sc.Check(soa, true, "Ec", args) && sc.CheckInstantiableNonArray(soa, c)) {
+ if (sc.Check(soa, true, "Ec", args) && sc.CheckNonArray(soa, c)) {
JniValueType result;
result.L = baseEnv(env)->AllocObject(env, c);
if (sc.Check(soa, false, "L", &result)) {
@@ -2211,7 +2211,7 @@ class CheckJNI {
ScopedCheck sc(kFlag_Default, __FUNCTION__);
VarArgs rest(mid, vargs);
JniValueType args[4] = {{.E = env}, {.c = c}, {.m = mid}, {.va = &rest}};
- if (sc.Check(soa, true, "Ecm.", args) && sc.CheckInstantiableNonArray(soa, c) &&
+ if (sc.Check(soa, true, "Ecm.", args) && sc.CheckNonArray(soa, c) &&
sc.CheckConstructor(mid)) {
JniValueType result;
result.L = baseEnv(env)->NewObjectV(env, c, mid, vargs);
@@ -2237,7 +2237,7 @@ class CheckJNI {
ScopedCheck sc(kFlag_Default, __FUNCTION__);
VarArgs rest(mid, vargs);
JniValueType args[4] = {{.E = env}, {.c = c}, {.m = mid}, {.va = &rest}};
- if (sc.Check(soa, true, "Ecm.", args) && sc.CheckInstantiableNonArray(soa, c) &&
+ if (sc.Check(soa, true, "Ecm.", args) && sc.CheckNonArray(soa, c) &&
sc.CheckConstructor(mid)) {
JniValueType result;
result.L = baseEnv(env)->NewObjectA(env, c, mid, vargs);