Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • asm asm
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • asmasm
  • asmasm
  • Issues
  • #317785
Closed
Open
Issue created Mar 29, 2017 by cushon@cushon

NPE in MethodRemapper with 'chop' stack map frames and tree API

Using ClassNode together with ClassRemapper causes an NPE. FrameNode#accept(MethodVisitor) passes null for the local array when calling visitFrame, and 
MethodRemapper's implementation of visitFrame assumes the array is non-null.

===
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.commons.ClassRemapper;
import org.objectweb.asm.commons.Remapper;
import org.objectweb.asm.tree.ClassNode;

public class Test {

  public static void main(String[] args) throws Exception {
    ClassNode node = new ClassNode();
    new ClassReader(Input.class.getName()).accept(node, 0);
    node.accept(new ClassRemapper(new ClassWriter(ClassWriter.COMPUTE_MAXS), new 
Remapper() {}));
  }

  private static final class Input {
    public static int f() {
      int x = 0;
      for (int i = 0; i < 10; ++i) {
        x++;
      }
      for (int i = 0; i < 10; ++i) {
        x++;
      }
      return x;
    }
  }
}
===

Exception in thread "main" java.lang.NullPointerException
	at 
org.objectweb.asm.commons.MethodRemapper.remapEntries(MethodRemapper.java:97)
	at org.objectweb.asm.commons.MethodRemapper.visitFrame(MethodRemapper.java:91)
	at org.objectweb.asm.tree.FrameNode.accept(FrameNode.java:155)
	at org.objectweb.asm.tree.InsnList.accept(InsnList.java:162)
	at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:817)
	at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:727)
	at org.objectweb.asm.tree.ClassNode.accept(ClassNode.java:412)
	at Test.main(Test.java:14)
Assignee
Assign to
Time tracking