changeset 1290:ce9956fe8908

2008-12-22 Gary Benson <gbenson@redhat.com> * patches/icedtea-io_util-overflow.patch: New file. * Makefile.am (ICEDTEA_PATCHES): Apply the above. * HACKING: Document the above.
author Gary Benson <gbenson@redhat.com>
date Mon, 22 Dec 2008 09:47:50 -0500
parents c10244d778ac
children be0f5e6d2733
files ChangeLog HACKING Makefile.am patches/icedtea-io_util-overflow.patch
diffstat 4 files changed, 47 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Dec 21 15:53:12 2008 +0100
+++ b/ChangeLog	Mon Dec 22 09:47:50 2008 -0500
@@ -1,3 +1,9 @@
+2008-12-22  Gary Benson  <gbenson@redhat.com>
+
+	* patches/icedtea-io_util-overflow.patch: New file.
+	* Makefile.am (ICEDTEA_PATCHES): Apply the above.
+	* HACKING: Document the above.
+
 2008-12-21  Matthias Klose  <doko@ubuntu.com>
 
 	* Makefile.am (ICEDTEA_ENV, ICEDTEA_ENV_GCJ): Prepend directories
--- a/HACKING	Sun Dec 21 15:53:12 2008 +0100
+++ b/HACKING	Mon Dec 22 09:47:50 2008 -0500
@@ -67,7 +67,7 @@
   divide by zero on tiny paths.
 * icedtea-alsa-default-device.patch: Fix problems with using the ALSA 'default' device.
 * icedtea-linker-libs-order.patch: When linking, put the referenced libraries after the object files (PR237).
-* icedtea-f2i-overflow.patch: Replaces the code used by [fd]2[il] bytecodes to correctly handle overflows. (PR244)
+* icedtea-f2i-overflow.patch: Replaces the code used by [fd]2[il] bytecodes to correctly handle overflows. (PR244, S6779290)
 * icedtea-cc-interp-no-fer.patch: Report that we cannot force early returns with the C++ interpreter.
 * icedtea-6761856-freetypescaler.patch: Fix IcedTea bug #227, OpenJDK bug
   #6761856, swing TextLayout.getBounds() returns shifted bounds.
@@ -77,6 +77,7 @@
 * icedtea-6728542-epoll.patch: Make EPoll work on non-x86 platforms. (PR265)
 * icedtea-fortify-source.patch: Fix build failures with -D_FORTIFY_SOURCE=2.
 * icedtea-format-warnings.patch: Fix build failures with -Wformat=1.
+* patches/icedtea-io_util-overflow.patch: Replace some code to correctly handle overflows.
 
 The following patches are only applied to OpenJDK6 in IcedTea6:
 
--- a/Makefile.am	Sun Dec 21 15:53:12 2008 +0100
+++ b/Makefile.am	Mon Dec 22 09:47:50 2008 -0500
@@ -642,7 +642,8 @@
 	patches/icedtea-display-mode-changer.patch \
 	patches/icedtea-testenv.patch \
 	patches/icedtea-samejvm-safe.patch \
-	patches/icedtea-6728542-epoll.patch
+	patches/icedtea-6728542-epoll.patch \
+	patches/icedtea-io_util-overflow.patch
 
 if WITH_ALT_HSBUILD
 ICEDTEA_PATCHES += \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/icedtea-io_util-overflow.patch	Mon Dec 22 09:47:50 2008 -0500
@@ -0,0 +1,37 @@
+diff -r 201a75db9b35 openjdk/jdk/src/share/native/java/io/io_util.c
+--- openjdk/jdk/src/share/native/java/io/io_util.c	Mon Dec 22 12:32:44 2008 +0000
++++ openjdk/jdk/src/share/native/java/io/io_util.c	Mon Dec 22 12:48:49 2008 +0000
+@@ -25,6 +25,7 @@
+ 
+ #include <stdlib.h>
+ #include <string.h>
++#include <assert.h>
+ 
+ #include "jni.h"
+ #include "jni_util.h"
+@@ -73,9 +74,10 @@
+         return -1;
+     }
+     datalen = (*env)->GetArrayLength(env, bytes);
++    assert(datalen >= 0);
+ 
+-    if ((off < 0) || (off > datalen) ||
+-        (len < 0) || ((off + len) > datalen) || ((off + len) < 0)) {
++    if ((off < 0) || (len < 0) ||
++        (((uint32_t) off + (uint32_t) len) > (uint32_t) datalen)) {
+         JNU_ThrowByName(env, "java/lang/IndexOutOfBoundsException", 0);
+         return -1;
+     }
+@@ -146,9 +148,10 @@
+         return;
+     }
+     datalen = (*env)->GetArrayLength(env, bytes);
++    assert(datalen >= 0);
+ 
+-    if ((off < 0) || (off > datalen) ||
+-        (len < 0) || ((off + len) > datalen) || ((off + len) < 0)) {
++    if ((off < 0) || (len < 0) ||
++        (((uint32_t) off + (uint32_t) len) > (uint32_t) datalen)) {
+         JNU_ThrowByName(env, "java/lang/IndexOutOfBoundsException", 0);
+         return;
+     }