jdis: Incorrectly processes lookupswitch, wide, and tableswitch instructions with an incorrect structure

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • None
    • Affects Version/s: asm_tools_9.0
    • Component/s: tools
    • None

      Asmtools should be able to process corrupted binaries as much as possible.
      jdis cannot print the complete output if the class file contains lookupswitch, wide, or tableswitch instructions with an incorrect structure, and it does not provide details about the structural issue:
      >jdis lookupswitch00301m11n.class
      package javasoft/sqe/tests/vm/instr/lookupswitch/lookupswitch003/lookupswitch00301m1;
      public class lookupswitch00301m11n version 45:3
      {
        public static Method run:"([Ljava/lang/String;Ljava/io/PrintStream;)I"
      jdis - ERROR: Fatal exception in file: lookupswitch00301m11n.class
      Expected output should be:
      jdis lookupswitch00301m11n.class
      package javasoft/sqe/tests/vm/instr/lookupswitch/lookupswitch003/lookupswitch00301m1;

      public class lookupswitch00301m11n version 45:3
      {
        public static Method run:"([Ljava/lang/String;Ljava/io/PrintStream;)I"
          stack 3 locals 2
        {
               sipush 1;
               lookupswitch {
                       BOGUS;
                    };
               nop;
               nop;
               nop;
               lconst_0;
               impdep2 255;
               impdep2 255;
        L12: iconst_0;
               ireturn;
        }

        SourceFile "lookupswitch00301m11n.jasm";
      } // end Class javasoft/sqe/tests/vm/instr/lookupswitch/lookupswitch003/lookupswitch00301m1/lookupswitch00301m11n compiled from "lookupswitch00301m11n.jasm"
      jdis - ERROR: The index -1 is out of range for the code array of the method.
      1 error(s) in the file: lookupswitch00301m11n.class

            Assignee:
            Leonid Kuskov
            Reporter:
            Leonid Kuskov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: