This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Another wrong array index in natClass.cc
- To: java at gcc dot gnu dot org
- Subject: Another wrong array index in natClass.cc
- From: Martin Kahlert <martin dot kahlert at infineon dot com>
- Date: Mon, 21 May 2001 11:47:39 +0200
- Cc: java-patches at gcc dot gnu dot org
- Reply-To: martin dot kahlert at infineon dot com
Hi!
This needs someone with better knowledge of natClass.cc than me:
The patch fixes the obvious bug, but the problem may be deeper.
In my application offset was -1 (found by Electric Fence and EF_PROTECT_BELOW)
Bye,
Martin.
2001-05-21 Martin Kahlert <martin.kahlert@infineon.com>
* java/lang/natClass.cc (_Jv_IsAssignableFrom): Ensure that offset
is positive
diff -rc gcc-20010514.orig/libjava/java/lang/natClass.cc gcc-20010514/libjava/java/lang/natClass.cc
*** gcc-20010514.orig/libjava/java/lang/natClass.cc Sun May 6 16:08:26 2001
--- gcc-20010514/libjava/java/lang/natClass.cc Mon May 21 11:35:55 2001
***************
*** 935,944 ****
if (__builtin_expect ((if_idt == NULL), false))
return false; // No class implementing TARGET has been loaded.
jshort cl_iindex = cl_idt->cls.iindex;
if (cl_iindex < if_idt->iface.ioffsets[0])
{
jshort offset = if_idt->iface.ioffsets[cl_iindex];
! if (offset < cl_idt->cls.itable_length
&& cl_idt->cls.itable[offset] == target)
return true;
}
--- 935,944 ----
if (__builtin_expect ((if_idt == NULL), false))
return false; // No class implementing TARGET has been loaded.
jshort cl_iindex = cl_idt->cls.iindex;
if (cl_iindex < if_idt->iface.ioffsets[0])
{
jshort offset = if_idt->iface.ioffsets[cl_iindex];
! if (offset < cl_idt->cls.itable_length && offset >= 0
&& cl_idt->cls.itable[offset] == target)
return true;
}
--
The early bird gets the worm. If you want something else for
breakfast, get up later.