Uploaded image for project: 'Commons BCEL'
  1. Commons BCEL
  2. BCEL-134

ExecutionVisitor doesn't support Class constant type for LDC and LDC_W

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 5.2
    • 6.0
    • Main
    • None

    Description

      Methods visitLDC() and visitLDC_W() push no values in the stack frame when the
      constant type is a class literal, as can happen with Java 1.5 bytecode. This
      leads to a false stack underflow exception happening to a subsequent
      instruction:

      java.lang.ArrayIndexOutOfBoundsException: -1
      at java.util.ArrayList.remove(ArrayList.java:390)
      at
      org.apache.bcel.verifier.structurals.OperandStack.pop(OperandStack.java:135)
      at
      org.apache.bcel.verifier.structurals.ExecutionVisitor.visitPUTFIELD(ExecutionVisitor.java:1059)
      at org.apache.bcel.generic.PUTFIELD.accept(PUTFIELD.java:78)

      Moreover, it would be desired to throw an exception when an unknown constant
      type is encountered, rather than doing nothing at all.

      This bug arises while running JiST/SWANS, a network simulator that relies on
      rewriting Java bytecode to implement simulation time. To be more specific, it
      arises when running the example UDP test application, launching
      jist.runtime.Main with arguments "jist.swans.Main driver.udp".

      I've attached a possible patch against its HEAD revision (411573).

      Enrico

      Attachments

        1. ExecutionVisitor-2.diff
          1 kB
          Enrico Gueli
        2. ExecutionVisitor.diff
          2 kB
          Enrico Gueli

        Activity

          People

            issues@commons.apache.org Apache Commons Developers
            enrico.gueli@polito.it Enrico Gueli
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: