Patch for an off by one error in _Jv_FindIIndex (another one)

Martin Kahlert martin.kahlert@infineon.com
Wed May 16 01:51:00 GMT 2001


Hi!
I found another off by one error in the same file.
Here is the complete patch.

Bye,
Martin.

2001-05-16  Martin Kahlert  <martin.kahlert@infineon.com>

	* java/lang/natClass.cc (_Jv_FindIIndex): Fix an off by one error
	* java/lang/natClass.cc (_Jv_IsAssignableFrom): Likewise


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	Wed May 16 10:39:46 2001
***************
*** 935,941 ****
        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
--- 935,941 ----
        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
***************
*** 1319,1325 ****
          {
  	  if (j >= num)
  	    goto found;
! 	  if (i > ifaces[j]->idt->iface.ioffsets[0])
  	    continue;
  	  int ioffset = ifaces[j]->idt->iface.ioffsets[i];
  	  /* We can potentially share this position with another class. */
--- 1319,1325 ----
          {
  	  if (j >= num)
  	    goto found;
! 	  if (i >= ifaces[j]->idt->iface.ioffsets[0])
  	    continue;
  	  int ioffset = ifaces[j]->idt->iface.ioffsets[i];
  	  /* We can potentially share this position with another class. */


-- 
The early bird gets the worm. If you want something else for       
breakfast, get up later.



More information about the Java mailing list