asm issueshttps://gitlab.ow2.org/asm/asm/-/issues2017-12-26T10:11:34Zhttps://gitlab.ow2.org/asm/asm/-/issues/317132ASM 5.0 do not supported JDK 1.5?2017-12-26T10:11:34ZsmileemakerASM 5.0 do not supported JDK 1.5?```
org.objectweb.asm.commons.SerialVersionUIDAdder
@Override
public void visit(final int version, final int access, final String name,
final String signature, final String superName,
final String[] inter...```
org.objectweb.asm.commons.SerialVersionUIDAdder
@Override
public void visit(final int version, final int access, final String name,
final String signature, final String superName,
final String[] interfaces) {
computeSVUID = (access & Opcodes.ACC_INTERFACE) == 0;
if (computeSVUID) {
this.name = name;
this.access = access;
this.interfaces = Arrays.copyOf(interfaces, interfaces.length);
}
super.visit(version, access, name, signature, superName, interfaces);
}
Arrays.copyOf <- this method support to jdk 1.6
Thanks for releasing ASM 5.0.
```https://gitlab.ow2.org/asm/asm/-/issues/317131Infinite loop in InstructionAdapter.invokestatic(...)2018-02-11T12:51:07ZcushonInfinite loop in InstructionAdapter.invokestatic(...)```
There appears to be a typo in InstructionAdapter causing infinite recursion when invokestatic is called
with API version ASM4:
import org.objectweb.asm.commons.InstructionAdapter;
import org.objectweb.asm.Opcodes;
import org.object...```
There appears to be a typo in InstructionAdapter causing infinite recursion when invokestatic is called
with API version ASM4:
import org.objectweb.asm.commons.InstructionAdapter;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.MethodVisitor;
public class AsmTest {
public static void main(String[] args) {
new InstructionAdapter(Opcodes.ASM4, new MethodVisitor(Opcodes.ASM4){}) {
}.invokestatic("owner", "name", "desc");
}
}
...
Exception in thread "main" java.lang.StackOverflowError
at org.objectweb.asm.commons.InstructionAdapter.invokestatic(InstructionAdapter.java:1072)
at org.objectweb.asm.commons.InstructionAdapter.invokestatic(InstructionAdapter.java:1064)
at org.objectweb.asm.commons.InstructionAdapter.invokestatic(InstructionAdapter.java:1077)
at org.objectweb.asm.commons.InstructionAdapter.invokestatic(InstructionAdapter.java:1064)
The fix is probably:
Index: src/org/objectweb/asm/commons/InstructionAdapter.java
=================================================================
==
--- src/org/objectweb/asm/commons/InstructionAdapter.java (revision 1729)
+++ src/org/objectweb/asm/commons/InstructionAdapter.java (working copy)
@@ -1060,7 +1060,7 @@
@Deprecated
public void invokestatic(final String owner, final String name,
final String desc) {
- if (api < Opcodes.ASM5) {
+ if (api >= Opcodes.ASM5) {
invokestatic(owner, name, desc, false);
return;
}
```https://gitlab.ow2.org/asm/asm/-/issues/316691Incorrect StackMapFrame calculations for large > 32k methods in Java 72017-12-26T10:13:02ZminskoIncorrect StackMapFrame calculations for large > 32k methods in Java 7```
See the attached repo. The class with methods > 32K has a VerifyError in Java
7, while the class with the same structure but < 32K works correctly.
``````
See the attached repo. The class with methods > 32K has a VerifyError in Java
7, while the class with the same structure but < 32K works correctly.
```https://gitlab.ow2.org/asm/asm/-/issues/316660asm does not work with java8 lambda2017-12-26T10:14:01Zdolesasm does not work with java8 lambda```
I converted a webapp project from java7 to java8. this webapp project uses weld
from JBOSS which uses Javassist and which in turn uses ASM. My app fails at
startup because ASM cannot read lambda expressions and do what it needs to ...```
I converted a webapp project from java7 to java8. this webapp project uses weld
from JBOSS which uses Javassist and which in turn uses ASM. My app fails at
startup because ASM cannot read lambda expressions and do what it needs to do.
The work around is to not use lambda (even when using java8) that works without
any problems. I would really like to use lambda (as will many others once it
comes out). Is there a plan to make ASM work with java8?
I am not good at ASM, Javassist or such system level things, but I will be happy
to provide a small sample of a project that does not work. In any case, it is
very evident. If you simply upgrade to java8 and use a lamda expression
anywhere, ASM blows up.
Thank you.
```https://gitlab.ow2.org/asm/asm/-/issues/317127duplicate entries in InnerClasses attribute2017-12-26T10:12:11Zcushonduplicate entries in InnerClasses attribute```
ASM creates duplicate entries in the InnerClasses attribute of the attached class when it rewrites the
constant pool.
Repro:
$ javac -cp lib/asm-5.0_BETA.jar Test.java
$ java -cp .:lib/asm-5.0_BETA.jar Test weird/JavacWeirdnessTes...```
ASM creates duplicate entries in the InnerClasses attribute of the attached class when it rewrites the
constant pool.
Repro:
$ javac -cp lib/asm-5.0_BETA.jar Test.java
$ java -cp .:lib/asm-5.0_BETA.jar Test weird/JavacWeirdnessTester.class out.class
$ javap -v out.class | head
…
InnerClasses:
static #7 of #2; //class weird/JavacWeirdnessTester$1 of class weird/JavacWeirdnessTester
static #7 of #2; //class weird/JavacWeirdnessTester$1 of class weird/JavacWeirdnessTester
static #7 of #2; //class weird/JavacWeirdnessTester$1 of class weird/JavacWeirdnessTester
The "JavacWeirdnessTester" class comes from a gwt test[1], and was compiled using javac8 -source 7 -
target 7.
[1] https://code.google.com/p/google-web-
toolkit/source/browse/trunk/dev/core/test/com/google/gwt/dev/javac/GeneratedClassnameFinderTest.j
ava
```https://gitlab.ow2.org/asm/asm/-/issues/317123ASM5.0: Class MethodNode broken?2017-12-26T10:12:21ZmarchofASM5.0: Class MethodNode broken?```
Thanks for releasing ASM 5.0!
Unfortunately it looks like at least one class file in asm-all-5.0.jar is
broken: Using the class MethodNode leads to the following error:
java.lang.ClassFormatError: Repetitive field name/signature in...```
Thanks for releasing ASM 5.0!
Unfortunately it looks like at least one class file in asm-all-5.0.jar is
broken: Using the class MethodNode leads to the following error:
java.lang.ClassFormatError: Repetitive field name/signature in class file
org/objectweb/asm/tree/MethodNode
Indeed if you decompile the class the following field is declared twice:
static java.lang.Class class$org$objectweb$asm$tree$MethodNode;
descriptor: Ljava/lang/Class;
flags: ACC_STATIC
Synthetic: true
The problem didn't exist with ASM 5.0 beta.
```https://gitlab.ow2.org/asm/asm/-/issues/317112Incorrect stackmap generated seems related to switch and Object[][]2017-12-26T10:12:40ZtvlatasIncorrect stackmap generated seems related to switch and Object[][]```
Hi,
We are seeing an invalid stackmap frame being generated and have narrowed down
the reproducer to a fairly simple class along these lines:
import java.math.BigDecimal;
public class SimpObjRet {
public static void main(String...```
Hi,
We are seeing an invalid stackmap frame being generated and have narrowed down
the reproducer to a fairly simple class along these lines:
import java.math.BigDecimal;
public class SimpObjRet {
public static void main(String [] args) {
try {
makeJavaArray(20, 7);
} catch(Exception e) {
e.printStackTrace();
}
}
public static Object[] makeJavaArray(int i, int j) throws Exception {
Object [] obj = null;
switch(j) {
case 7:
obj = new BigDecimal[i];
break;
case 12:
obj = new String[i];
break;
case -2:
obj = new byte[i][];
break;
default:
throw new Exception("failed");
}
return obj;
}
}
Simply reading the class and writing computing the frames is enough to show
this:
ClassReader cr = new ClassReader(bytes);
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
cr.accept(cw, ClassReader.SKIP_FRAMES);
out = cw.toByteArray();
In the resulting class bytes what we see is an initial append frame with an
Opcode.NULL which looks odd, but may not itself be an issue. But at the end of
the method just before the ALOAD we see a full frame which has
a "java/lang/Object" for the local rather than a "[java/lang/Object". That
seems to be the frame that the verifier is unhappy with.
For example:
mv.visitFrame(Opcodes.F_FULL, 3, new Object[] {Opcodes.INTEGER,
Opcodes.INTEGER, "java/lang/Object"}, 0, new Object[] {});
I'm attaching a zip with a reproducer as well. The zip has files from my run
locally (before/after classes), but you can unzip and run it, the "ant"
default should build/run it
thanks
Tony
```https://gitlab.ow2.org/asm/asm/-/issues/317111source debug extension size should not be limeted to 64k2018-01-20T08:38:24Zlauritsource debug extension size should not be limeted to 64k```
cw.visitSource("Test.java", new String(new char[100000]));
Fails with IllegalArgumentException from ByteVector.putUTF8
Probably caused by http://forge.ow2.org/tracker/?
group_id=23&atid=100023&func=detail&aid=316506
``````
cw.visitSource("Test.java", new String(new char[100000]));
Fails with IllegalArgumentException from ByteVector.putUTF8
Probably caused by http://forge.ow2.org/tracker/?
group_id=23&atid=100023&func=detail&aid=316506
```https://gitlab.ow2.org/asm/asm/-/issues/316683Local variables not processed after jump instruction in AnalyzerAdapter2017-12-26T10:13:30ZkammererLocal variables not processed after jump instruction in AnalyzerAdapter```
On visiting jump instruction AnalyzerAdapter resets locals and stack
so after processing "if () {...} else {...}" statement no any local is
processed and maxLocals info not updated:
public void visitJumpInsn(final int opcode, final...```
On visiting jump instruction AnalyzerAdapter resets locals and stack
so after processing "if () {...} else {...}" statement no any local is
processed and maxLocals info not updated:
public void visitJumpInsn(final int opcode, final Label label) {
if (mv != null) {
mv.visitJumpInsn(opcode, label);
}
execute(opcode, 0, null);
if (opcode == Opcodes.GOTO) {
this.locals = null;
this.stack = null;
}
}
NB: Is it any other possibilites to calc maxLocals?
```https://gitlab.ow2.org/asm/asm/-/issues/316682maxLocals not updated in AnalyzerAdapter constructor2018-02-18T08:03:02ZkammerermaxLocals not updated in AnalyzerAdapter constructor```
Local list are change in AnalyzerAdapter constructor, but maxLocal not updated.
So when Analyzer.analyze is excuted it fails at setLocal:
if ((m.access & ACC_STATIC) == 0) {
Type ctype = Type.getObjectType(owner)...```
Local list are change in AnalyzerAdapter constructor, but maxLocal not updated.
So when Analyzer.analyze is excuted it fails at setLocal:
if ((m.access & ACC_STATIC) == 0) {
Type ctype = Type.getObjectType(owner);
current.setLocal(local++, interpreter.newValue(ctype));
}
with Caused by: java.lang.IndexOutOfBoundsException: Trying to access an
inexistant local variable 0
```https://gitlab.ow2.org/asm/asm/-/issues/316630Type verification in CheckAnnotationAdapter2018-01-21T13:50:46ZsyllantType verification in CheckAnnotationAdapter```
Hi,
Seems there is a bug in org.objectweb.asm.util.CheckAnnotationAdapter#visit()
while checking type of annotation value.
The new verification introduced in revision 1516
(http://websvn.ow2.org/diff.php?
repname=asm&path=%2Ftrun...```
Hi,
Seems there is a bug in org.objectweb.asm.util.CheckAnnotationAdapter#visit()
while checking type of annotation value.
The new verification introduced in revision 1516
(http://websvn.ow2.org/diff.php?
repname=asm&path=%2Ftrunk%2Fasm%2Fsrc%2Forg%2Fow2%2Fasm%2Futil%2FCheckAnnotation
Adapter.java&rev=1516&peg=1516) prevents from using a primitive class, e.g.:
@MyAnnotation(type=boolean.class), whereas @MyAnnotation(type=Boolean.class)
works.
Regards
Sylvain
```https://gitlab.ow2.org/asm/asm/-/issues/316545ASM incorrectly merges Object[] and byte[][] in StackMapTable2017-12-26T10:15:19ZpslaterASM incorrectly merges Object[] and byte[][] in StackMapTable```
ASM incorrectly merges Object[] and byte[][] in StackMapTable
Newer 1.7 JREs hit VerifyError loading classes with byte[][] in stacks after
manipulation with ASM. The StackMapTable entry for byte[][] is not correct
following manipul...```
ASM incorrectly merges Object[] and byte[][] in StackMapTable
Newer 1.7 JREs hit VerifyError loading classes with byte[][] in stacks after
manipulation with ASM. The StackMapTable entry for byte[][] is not correct
following manipulation - becomes Object[].
Minimal recreate attached in a.java courtesy of Brett Kail.
Reproducible with latest stable ASM 5 and 4 using
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode).
Result from running recreate:
Exception in thread "main" java.lang.VerifyError: Bad return type
Exception Details:
Location:
a.m(Z)[Ljava/lang/Object; @15: areturn
Reason:
Type 'java/lang/Object' (current frame, stack[0]) is not assignable to
'[Ljava/lang/Object;' (from method signature)
Current Frame:
bci: @15
flags: { }
locals: { integer }
stack: { 'java/lang/Object' }
Bytecode:
0000000: 1a99 000a 03bd 0004 a700 0703 bd00 48b0
0000010:
Stackmap Table:
same_frame(@11)
same_locals_1_stack_item_frame(@15,Object[#4])
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getDeclaredMethod(Class.java:2002)
at a$1.<init>(a.java:13)
at a.main(a.java:13)
```https://gitlab.ow2.org/asm/asm/-/issues/316553InsnListIterator can't get previous entry after exec "remove()"2017-12-26T10:14:45ZyogpstopInsnListIterator can't get previous entry after exec "remove()"```
org.objectweb.asm.tree.InsnList.InsnListIterator.remove() has problem.
This method call org.objectweb.asm.tree.InsnList.remove(prev), and set previous entry.
But org.objectweb.asm.tree.InsnList.remove(prev) remove prev's previous ent...```
org.objectweb.asm.tree.InsnList.InsnListIterator.remove() has problem.
This method call org.objectweb.asm.tree.InsnList.remove(prev), and set previous entry.
But org.objectweb.asm.tree.InsnList.remove(prev) remove prev's previous entry.
So previous entry becomes null.
I have solution. But I don't know how to send pull request. Sorry.
I paste my idea in this post.
Current source(org.objectweb.asm.tree.InsnList.InsnListIterator.remove())
public void remove() {
InsnList.this.remove(prev);
prev = prev.prev;
}
My idea(org.objectweb.asm.tree.InsnList.InsnListIterator.remove())
public void remove() {
prev = prev.prev;
InsnList.this.remove(prev);
}
This code has problem?
If not, I hope to merge it.
Thanks.
```https://gitlab.ow2.org/asm/asm/-/issues/316555Wrong maxLocals calculation in AnalyzerAdapter2018-02-24T09:41:20ZkammererWrong maxLocals calculation in AnalyzerAdapter```
maxLocals = Math.max(maxLocals, local);
it seems it should be maxLocals = Math.max(maxLocals, local + 1);
``````
maxLocals = Math.max(maxLocals, local);
it seems it should be maxLocals = Math.max(maxLocals, local + 1);
```https://gitlab.ow2.org/asm/asm/-/issues/316547Incorrect stackmap calculation for the catch block2017-12-26T10:14:59ZszegediaIncorrect stackmap calculation for the catch block```
I'm attaching a small reproducer for the problem I have - it generates bytecode that fails to validate
both with ASM 4.2 and latest 5.0-BETA from Maven Central. The issue seems to be as follows:
- I have a local variable, declared ...```
I'm attaching a small reproducer for the problem I have - it generates bytecode that fails to validate
both with ASM 4.2 and latest 5.0-BETA from Maven Central. The issue seems to be as follows:
- I have a local variable, declared Object.
- I store null into it.
- Then I enter a try block.
- In the try block, I store a String into the variable.
- Still in the try block, I store an Integer into the variable.
- Then I return it. Try block ends here.
- Then I create a catch block, which only does an ATHROW.
The Java code that compiles to bytecode identical to the one emitted by the reproducer is:
public class X {
private static String S;
private static Integer I;
public static Object foo() {
Object x = null;
try {
x = S;
x = I;
return x;
} catch(Throwable t) {
throw t;
}
}
}
The stack map for the catch block presumes the type of the variable is Integer, when in reality, it
should be Object, as the common supertype of String and Integer.
Interestingly, the bug only occurs if I start the method with ACONST_NULL, ASTORE 0 still outside the
try block. If I don't explicitly initialize the variable to null outside the try block, or move this
initialization inside the try block, then the generated stack map is correct.
```https://gitlab.ow2.org/asm/asm/-/issues/316534Inner class nodes do not correctly report accessibility2017-12-26T10:15:51ZgfraserInner class nodes do not correctly report accessibility```
In the following example, ASM does not report that the class node for Foo$Bar has private access:
public class Foo {
private class Bar {
}
}
E.g., if I do:
ClassReader reader = new ClassReader(new FileInputStream("Foo$Bar.clas...```
In the following example, ASM does not report that the class node for Foo$Bar has private access:
public class Foo {
private class Bar {
}
}
E.g., if I do:
ClassReader reader = new ClassReader(new FileInputStream("Foo$Bar.class"));
ClassNode classNode = new ClassNode();
reader.accept(classNode, ClassReader.SKIP_FRAMES);
then classNode.access & Opcodes.ACC_PRIVATE equals 0.
However, the class node for Foo$Bar has an inner class node with name Foo$Bar which does have private
accessibility. The same holds for static or protected accessibility.
If I change the example to:
class Foo {
public class Bar {
}
}
then classNode.access & Opcodes.ACC_PUBLIC _is_ true, interestingly (but so it also is for the inner class
node with the same name). ACC_ABSTRACT also seems to be working correctly.
Do I miss something here, or is ASM wrong about accessibility of inner classes?
```https://gitlab.ow2.org/asm/asm/-/issues/316506ByteVector doesn't validate byteLength in putUTF8()2017-12-26T10:16:12ZmederByteVector doesn't validate byteLength in putUTF8()```
ByteVector class doesn't validate byteLength value to ensure it fits in 2 bytes
in putUTF8() method.
``````
ByteVector class doesn't validate byteLength value to ensure it fits in 2 bytes
in putUTF8() method.
```https://gitlab.ow2.org/asm/asm/-/issues/316498org/objectweb/asm/tree/MethodNode.getLabelNode -- LabelNode has no back-refer...2017-12-26T10:16:26Zvsilaevorg/objectweb/asm/tree/MethodNode.getLabelNode -- LabelNode has no back-reference to Label```
There is a bug introduced in Rev. 1632 -- getLabelNode() method does not
configure Label.info properly, the reference back to Label is missing (no
constructor parameter supplied).
The bug affects version 4.1 (stable)
Please check...```
There is a bug introduced in Rev. 1632 -- getLabelNode() method does not
configure Label.info properly, the reference back to Label is missing (no
constructor parameter supplied).
The bug affects version 4.1 (stable)
Please check the following diff: http://websvn.ow2.org/diff.php?
repname=asm&path=%2Ftrunk%2Fasm%2Fsrc%2Forg%2Fobjectweb%2Fasm%2Ftree%2FMethodNo
de.java&rev=1632&peg=1632
Related error stack traces:
1. When verifying generated class with CheckClassAdapter:
java.lang.IllegalStateException: Undefined label used
at org.objectweb.asm.util.CheckMethodAdapter.visitMaxs(Unknown Source)
at
org.apache.commons.javaflow.bytecode.transformation.asm4.ContinuableMethodVisit
or.visitMaxs(ContinuableMethodVisitor.java:340)
at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
at
org.apache.commons.javaflow.bytecode.transformation.asm4.ContinuableMethodNode.
visitEnd(ContinuableMethodNode.java:144)
2. When writing class file:
java.lang.NullPointerException
at org.objectweb.asm.Frame.a(Unknown Source)
at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source)
at
org.apache.commons.javaflow.bytecode.transformation.asm4.ContinuableMethodVisit
or.visitMaxs(ContinuableMethodVisitor.java:340)
at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
at
org.apache.commons.javaflow.bytecode.transformation.asm4.ContinuableMethodNode.
visitEnd(ContinuableMethodNode.java:144)
Workaround: subclass MethodNode and override getLabelNode with code from
revision 1594. Also, subclass ClassNode and override visitMethod to construct
fixed MethodNode-s.
```https://gitlab.ow2.org/asm/asm/-/issues/316488asm-tree is stripped of some generic signature info2017-12-26T10:18:23Zmbensonasm-tree is stripped of some generic signature info```
Presumably, anyway. It would seem perhaps the non-debug asm jars are
instrumented with a bit of their own dog food? I only know that asm-debug-
all.jar's ClassNode has generic lists e.g. member methods, while in the
equivalent cl...```
Presumably, anyway. It would seem perhaps the non-debug asm jars are
instrumented with a bit of their own dog food? I only know that asm-debug-
all.jar's ClassNode has generic lists e.g. member methods, while in the
equivalent class in asm-tree.jar this list and others are raw.
Thanks!
```https://gitlab.ow2.org/asm/asm/-/issues/316489Typos in Javadocs2017-12-26T10:18:13ZluontolaTypos in Javadocs```
(1) In various places in org.objectweb.asm.Handle's Javadocs the word "designed"
is used instead of "designated". Some of it seems copy-pasted, so perhaps also
other classes have the same typo - I recommend doing a grep for all sou...```
(1) In various places in org.objectweb.asm.Handle's Javadocs the word "designed"
is used instead of "designated". Some of it seems copy-pasted, so perhaps also
other classes have the same typo - I recommend doing a grep for all source code.
(2) The documentation for Handle.getOwner() and the Handle constructor talk about
"the internal name of the field or method". This seems to me incorrect - it
should be the name of the class that *owns* the field or method.
```