Change-Id: Ibb559ae41654660064f4a8df71274c4e4f16807a
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;
{
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");
}
}