Stack frame tag - wrong specification
In class Reader under method readFrame
private int readFrame(int stackMap, boolean zip, boolean unzip,
Context frame)
{
..
..
..
if (zip)
{
tag = b[stackMap++] & 0xFF;
} else {
tag = MethodWriter.FULL_FRAME;
frame.offset = -1;
}
..
..
}
Why are you assuming that if zip var is true then the frame tag is FULL_FRAME
?
The zip flag is being determined according to the following code located under
the method called readCode:
private void readCode(final MethodVisitor mv, final Context context, int u)
{
..
..
else if (FRAMES && "StackMap".equals(attrName)) {
if ((context.flags & SKIP_FRAMES) == 0) {
zip = false;
stackMap = u + 10;
stackMapSize = readInt(u + 4);
frameCount = readUnsignedShort(u + 8);
}
..
..
}
Running a degenerate method visitor on the attached class causing to the
following Exception:
java.lang.ArrayIndexOutOfBoundsException: 3
at org.objectweb.asm.ClassReader.readFrameType(ClassReader.java:2142)
at org.objectweb.asm.ClassReader.readFrame(Unknown Source)
at org.objectweb.asm.ClassReader.readCode(Unknown Source)
at org.objectweb.asm.ClassReader.readMethod(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
There is no full frame in the method StackMap (Output using javap):
StackMap: length = 0x5
00 03 18 07 07
You can see that the attribute_length is 3 and all the entries are less then
63, which means the frames should be tagged as same_frame
Attached is the relevant class
Thanks,
Hen