From 45d26c86b00580593067ca42091ad66cf7dc4f7c Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Tue, 24 Jun 2014 23:36:28 -0700 Subject: Treat larger than jint capacity in NewDirectByteBuffer as an error Bug: 15854028 Change-Id: If78921f4ba2b38a9d0bb421acf9c8bca962ed42a --- runtime/check_jni.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'runtime/check_jni.cc') diff --git a/runtime/check_jni.cc b/runtime/check_jni.cc index a81648958b..fefb907422 100644 --- a/runtime/check_jni.cc +++ b/runtime/check_jni.cc @@ -1757,9 +1757,7 @@ PRIMITIVE_ARRAY_FUNCTIONS(jdouble, Double, 'D'); CHECK_JNI_ENTRY(kFlag_Default, "EpJ", env, address, capacity); if (address == nullptr) { JniAbortF(__FUNCTION__, "non-nullable address is NULL"); - } - if (capacity < 0) { - JniAbortF(__FUNCTION__, "capacity must be non-negative: %" PRId64, capacity); + return nullptr; } return CHECK_JNI_EXIT("L", baseEnv(env)->NewDirectByteBuffer(env, address, capacity)); } -- cgit v1.2.3