This is the mail archive of the java-patches@sourceware.cygnus.com 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]

gcj: verification bug when exception range reaches method end


Gcj incorrectly reports "bad pc in exception table" if an exception
range extends all the way to the end of the method code:

    p_l$rfib$main.java: In class `p_l$rfib$main':
    p_l$rfib$main.java: In method `Call(jcon.vDescriptor)':
    p_l$rfib$main.java:0: bad pc in exception_table

The problem is that verify_jvm_instructions() is checking the (nonexistent)
instruction beyond the end of the range for validity.  Below is a patch.

   ---------------------------------------------------------------------------
   Gregg Townsend         Staff Scientist      The University of Arizona
   gmt@cs.arizona.edu     Computer Science     Tucson, Arizona, USA



*** verify.old	Mon Aug 23 17:53:47 1999
--- verify.c	Mon Aug 23 17:58:19 1999
*************** verify_jvm_instructions (jcf, byte_ops, 
*** 397,403 ****
  	  || handler_pc < 0 || handler_pc >= length
  	  || (handler_pc >= start_pc && handler_pc < end_pc)
  	  || ! (instruction_bits [start_pc] & BCODE_INSTRUCTION_START)
! 	  || ! (instruction_bits [end_pc] & BCODE_INSTRUCTION_START)
  	  || ! (instruction_bits [handler_pc] & BCODE_INSTRUCTION_START))
  	{
  	  error ("bad pc in exception_table");
--- 397,404 ----
  	  || handler_pc < 0 || handler_pc >= length
  	  || (handler_pc >= start_pc && handler_pc < end_pc)
  	  || ! (instruction_bits [start_pc] & BCODE_INSTRUCTION_START)
! 	  || (end_pc < length &&
! 	     ! (instruction_bits [end_pc] & BCODE_INSTRUCTION_START))
  	  || ! (instruction_bits [handler_pc] & BCODE_INSTRUCTION_START))
  	{
  	  error ("bad pc in exception_table");

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