summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/jni_internal.cc2
-rw-r--r--runtime/jni_internal_test.cc2
2 files changed, 2 insertions, 2 deletions
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index 2fadfb0f6a..8842f590ca 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -2454,7 +2454,7 @@ class JNI {
return nullptr;
}
- // At the moment, the capacity is limited to a jint (31 bits).
+ // At the moment, the capacity of DirectByteBuffer is limited to a signed int.
if (capacity > INT_MAX) {
JniAbortF("NewDirectByteBuffer", "buffer capacity greater than maximum jint: %" PRId64, capacity);
return nullptr;
diff --git a/runtime/jni_internal_test.cc b/runtime/jni_internal_test.cc
index 218ae95266..a933f86bcf 100644
--- a/runtime/jni_internal_test.cc
+++ b/runtime/jni_internal_test.cc
@@ -1518,7 +1518,7 @@ TEST_F(JniInternalTest, NewDirectBuffer_GetDirectBufferAddress_GetDirectBufferCa
{
CheckJniAbortCatcher check_jni_abort_catcher;
- env_->NewDirectByteBuffer(bytes, static_cast<jlong>(INT_MAX) * 2);
+ env_->NewDirectByteBuffer(bytes, static_cast<jlong>(INT_MAX) + 1);
check_jni_abort_catcher.Check("in call to NewDirectByteBuffer");
}
}