Java class file verification

John Bergin john.bergin at
Wed Jan 14 20:35:48 UTC 2015

Hi all.

I have a query regarding Java class file verification in particular
verification of the LocalVariableTable attribute defined by the Java
Virtual Machine 7 specification here,

The specification states that "The value of start_pc must be a valid
index into the code array of this Code attribute and must be the index
of the opcode of an instruction." And in the example below the
start_pc for args is 0 and for s it is 3 and both these indexes are
valid code array offsets.

  public static void main(java.lang.String[]);
      stack=1, locals=2, args_size=1
         0: ldc           #2                  // String A string
         2: astore_1
         3: return
        line 3: 0
        line 4: 3
        Start  Length  Slot  Name   Signature
               0       4     0  args   [Ljava/lang/String;
               3       1     1     s   Ljava/lang/String;

My question is: a program I'm helping to develop is dynamically
generating Java class files where the start_pc indexes are NOT valid
indexes into the code array (in fact they're off by one) and OpenJDK
is not rejecting the class via a ClassFormatException. Has anyone got
any idea why this is the case?

Kind regards,

More information about the discuss mailing list