Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7904019

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • None
    • asm_tools_9.0
    • 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

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

              Created:
              Updated:
              Resolved: