Java and the Java Virtual Machine (R. Stärk, J. Schmid, E. Börger)

Bugs in Verifiers

The following examples are taken from Jbook. Press the verify button to verify the corresponding class by your browser. Move the mouse after pressing the button in case there is no output. Note that some browsers crash while verifying some of these examples.
Figure 16.7 is a valid Java program. JDK 1.3 rejects the bytecode. IE 5.5 crashes while verifying the class.
public class Figure16_7 {
  public Figure16_7() { m(true); }

  static void m(boolean b) {
   try {
     try { if (b) return; }
     finally {
       try { if(b) return; }
       finally { if (b) return; }
     }
   } finally { if (b) return; }
  }
}



Figure 16.18 shows some strange arrangement of subroutines. IE 5.0 and IE 5.5 crash while verifying this bytecode. This bytecode maybe accepted or rejected (usually it is rejected).
   jsr S
   jsr L
   return
L:
   astore l
   jsr S
   ret l
S:
   astore s
   ret s



Example C.7.1 is a valid Java program. JDK 1.3 rejects the bytecode. However, the bytecode should be accepted and a NullPointerException should be raised.
public class ExampleC_7_1 {
  public ExampleC_7_1() {
    int[][] a = null;
    a[0] = new int[0];
  }
}


Home


ETH Home March 2001
Responsible
ETH Logo