EVALUATION
Please see the parent CR.
Suggested Fix:
--- a/src/share/native/java/io/io_util.c Wed Dec 10 14:03:15 2008 -0800
+++ b/src/share/native/java/io/io_util.c Tue Dec 23 20:07:06 2008 +0000
@@ -74,8 +74,7 @@ readBytes(JNIEnv *env, jobject this, jby
}
datalen = (*env)->GetArrayLength(env, bytes);
- if ((off < 0) || (off > datalen) ||
- (len < 0) || ((off + len) > datalen) || ((off + len) < 0)) {
+ if ((off < 0) || (len < 0) || (len > (datalen - off))) {
JNU_ThrowByName(env, "java/lang/IndexOutOfBoundsException", 0);
return -1;
}
@@ -147,8 +146,7 @@ writeBytes(JNIEnv *env, jobject this, jb
}
datalen = (*env)->GetArrayLength(env, bytes);
- if ((off < 0) || (off > datalen) ||
- (len < 0) || ((off + len) > datalen) || ((off + len) < 0)) {
+ if ((off < 0) || (len < 0) || (len > (datalen - off))) {
JNU_ThrowByName(env, "java/lang/IndexOutOfBoundsException", 0);
return;
}
|