This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch for an off by one error in _Jv_FindIIndex


Hi!
The subject says it all.
ioffsets[0] contains the length of ioffsets (including itself).
Thus its last accessible entry is at index position ioffsets[0]-1
(found by Electric Fence and a hello world example)

Bye,
Martin.

PS: Is there anybody besides Tom (how seems to be busy with other items these
    days), who can commit such simple bugfixes?
    I have two other patches pending 
    (cf. Threads 'Library problem in jni.cc on Linux'
    and 'Is this bugfix correct (jni.cc)?')


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

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

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 09:53:55 2001
***************
*** 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]