diff options
-rw-r--r-- | runtime/jni/check_jni.cc | 8 | ||||
-rw-r--r-- | runtime/jni/java_vm_ext.cc | 6 | ||||
-rw-r--r-- | runtime/jni/java_vm_ext_test.cc | 2 | ||||
-rw-r--r-- | runtime/jni/jni_env_ext.cc | 2 | ||||
-rw-r--r-- | runtime/jni/jni_env_ext.h | 2 |
5 files changed, 11 insertions, 9 deletions
diff --git a/runtime/jni/check_jni.cc b/runtime/jni/check_jni.cc index 32060117e7..1626357709 100644 --- a/runtime/jni/check_jni.cc +++ b/runtime/jni/check_jni.cc @@ -2729,8 +2729,8 @@ class CheckJNI { JniValueType args[2] = {{.E = env}, {.L = buf}}; if (sc.Check(soa, true, "EL", args)) { JniValueType result; - // Note: this is implemented in the base environment by a GetLongField which will sanity - // check the type of buf in GetLongField above. + // Note: this is implemented in the base environment by a GetLongField which will check the + // type of buf in GetLongField above. result.p = baseEnv(env)->GetDirectBufferAddress(env, buf); if (sc.Check(soa, false, "p", &result)) { return const_cast<void*>(result.p); @@ -2746,8 +2746,8 @@ class CheckJNI { JniValueType args[2] = {{.E = env}, {.L = buf}}; if (sc.Check(soa, true, "EL", args)) { JniValueType result; - // Note: this is implemented in the base environment by a GetIntField which will sanity - // check the type of buf in GetIntField above. + // Note: this is implemented in the base environment by a GetIntField which will check the + // type of buf in GetIntField above. result.J = baseEnv(env)->GetDirectBufferCapacity(env, buf); if (sc.Check(soa, false, "J", &result)) { return result.J; diff --git a/runtime/jni/java_vm_ext.cc b/runtime/jni/java_vm_ext.cc index e5b3d4de42..e085cd98cb 100644 --- a/runtime/jni/java_vm_ext.cc +++ b/runtime/jni/java_vm_ext.cc @@ -59,9 +59,11 @@ namespace art { using android::base::StringAppendF; using android::base::StringAppendV; -static constexpr size_t kGlobalsMax = 51200; // Arbitrary sanity check. (Must fit in 16 bits.) +// Maximum number of global references (must fit in 16 bits). +static constexpr size_t kGlobalsMax = 51200; -static constexpr size_t kWeakGlobalsMax = 51200; // Arbitrary sanity check. (Must fit in 16 bits.) +// Maximum number of weak global references (must fit in 16 bits). +static constexpr size_t kWeakGlobalsMax = 51200; bool JavaVMExt::IsBadJniVersion(int version) { // We don't support JNI_VERSION_1_1. These are the only other valid versions. diff --git a/runtime/jni/java_vm_ext_test.cc b/runtime/jni/java_vm_ext_test.cc index 4a7b1ca6ef..0363cdb345 100644 --- a/runtime/jni/java_vm_ext_test.cc +++ b/runtime/jni/java_vm_ext_test.cc @@ -151,7 +151,7 @@ TEST_F(JavaVmExtStackTraceTest, TestEnableDisable) { ASSERT_EQ(JNI_OK, ok); std::vector<jobject> global_refs_; - jobject local_ref = env->NewStringUTF("Dummy"); + jobject local_ref = env->NewStringUTF("Hello"); for (size_t i = 0; i < 2000; ++i) { global_refs_.push_back(env->NewGlobalRef(local_ref)); } diff --git a/runtime/jni/jni_env_ext.cc b/runtime/jni/jni_env_ext.cc index cf6a22ce9a..6e46c24744 100644 --- a/runtime/jni/jni_env_ext.cc +++ b/runtime/jni/jni_env_ext.cc @@ -40,7 +40,7 @@ namespace art { using android::base::StringPrintf; static constexpr size_t kMonitorsInitial = 32; // Arbitrary. -static constexpr size_t kMonitorsMax = 4096; // Arbitrary sanity check. +static constexpr size_t kMonitorsMax = 4096; // Maximum number of monitors held by JNI code. const JNINativeInterface* JNIEnvExt::table_override_ = nullptr; diff --git a/runtime/jni/jni_env_ext.h b/runtime/jni/jni_env_ext.h index 2c7ba3be02..5d4304d508 100644 --- a/runtime/jni/jni_env_ext.h +++ b/runtime/jni/jni_env_ext.h @@ -37,7 +37,7 @@ class Object; } // namespace mirror // Number of local references in the indirect reference table. The value is arbitrary but -// low enough that it forces sanity checks. +// low enough that it forces integrity checks. static constexpr size_t kLocalsInitial = 512; class JNIEnvExt : public JNIEnv { |