summaryrefslogtreecommitdiffstats
path: root/libjava
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-27 16:09:54 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-27 16:09:54 +0000
commitb86561da38467e46d8c3716809ec51c79e9124fc (patch)
tree67f51902ca9c330d6225fe727d38067e11c0d926 /libjava
parent37c7faa1d8772c95595348b6fbbccfdfe1abde7c (diff)
downloadppe42-gcc-b86561da38467e46d8c3716809ec51c79e9124fc.tar.gz
ppe42-gcc-b86561da38467e46d8c3716809ec51c79e9124fc.zip
* jni.cc (_Jv_JNI_GetPrimitiveArrayRegion): Fixed bounds
checking. (_Jv_JNI_SetPrimitiveArrayRegion): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41634 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog8
-rw-r--r--libjava/jni.cc14
2 files changed, 17 insertions, 5 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 3321bcb2cc3..74523a6722c 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,10 +1,16 @@
+2001-04-27 Tom Tromey <tromey@redhat.com>
+
+ * jni.cc (_Jv_JNI_GetPrimitiveArrayRegion): Fixed bounds
+ checking.
+ (_Jv_JNI_SetPrimitiveArrayRegion): Likewise.
+
2001-04-27 Martin Kahlert <martin.kahlert@infineon.com>
* include/jni.h (struct JNINativeInterface): Fixed types in
Get/Set*ArrayRegion declarations.
(class _Jv_JNIEnv): Likewise.
-2001-04-25 Bryce McKinlay <bryce@albatross.co.nz>
+2001-04-26 Alexandre Oliva <aoliva@redhat.com>
* configure.in: Obtain THREADS with `gcc -v'.
* configure: Rebuilt.
diff --git a/libjava/jni.cc b/libjava/jni.cc
index 6190f4f8d74..34f2995a408 100644
--- a/libjava/jni.cc
+++ b/libjava/jni.cc
@@ -1364,7 +1364,9 @@ _Jv_JNI_GetPrimitiveArrayRegion (JNIEnv *env, JArray<T> *array,
jsize start, jsize len,
T *buf)
{
- if (start < 0 || len >= array->length || start + len >= array->length)
+ // The cast to unsigned lets us save a comparison.
+ if (start < 0 || len < 0
+ || (unsigned long) (start + len) >= (unsigned long) array->length)
{
try
{
@@ -1389,7 +1391,9 @@ static void
_Jv_JNI_SetPrimitiveArrayRegion (JNIEnv *env, JArray<T> *array,
jsize start, jsize len, T *buf)
{
- if (start < 0 || len >= array->length || start + len >= array->length)
+ // The cast to unsigned lets us save a comparison.
+ if (start < 0 || len < 0
+ || (unsigned long) (start + len) >= (unsigned long) array->length)
{
try
{
@@ -1432,7 +1436,8 @@ _Jv_JNI_MonitorEnter (JNIEnv *env, jobject obj)
{
try
{
- return _Jv_MonitorEnter (obj);
+ _Jv_MonitorEnter (obj);
+ return 0;
}
catch (jthrowable t)
{
@@ -1446,7 +1451,8 @@ _Jv_JNI_MonitorExit (JNIEnv *env, jobject obj)
{
try
{
- return _Jv_MonitorExit (obj);
+ _Jv_MonitorExit (obj);
+ return 0;
}
catch (jthrowable t)
{
OpenPOWER on IntegriCloud