Another wrong array index in natClass.cc

Martin Kahlert martin.kahlert@infineon.com
Mon May 21 02:47:00 GMT 2001


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.



More information about the Java mailing list