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

Size of LDC_W's operand can be incorrect

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 5.2
    • Main
    • None

    Description

      When MethodGen read LDC_W whose index is less than 256 and dumps it, the size of
      its operand becomes incorrect.

      LDC_W's setIndex method can change both the opcode and the length.
      But after the invocation initFromFile method change the opcode OR the length.
      And its dump method determines the operand's size by the length.
      As a result that can make a mismatch b/w an opcode and an operand.

      LDC_W.java 1.1.1.1 and 1.3 has this problem.

      A scenario(in case of LDC_W.java 1.3):
      1. Suppose a LDC_W whose index is less than 256
      2. initFromFile method sets the opcode to LDC_W and the length to 2.
      3. dump method writes a LDC_W but it writes a byte as the operand.

      I think that 1.2 has no problem.
      Another solution is as follows.

      — LDC_W.java.1.1.1.1 Sat Dec 15 21:40:41 2001
      +++ LDC_W.java Wed Mar 26 00:36:01 2003
      @@ -82,6 +82,6 @@
      throws IOException

      { setIndex(bytes.readUnsignedShort()); - length = 3; + //length = 3; }

      }

      Attachments

        1. patch
          0.3 kB
          Stephen Kolaroff

        Activity

          People

            issues@commons.apache.org Apache Commons Developers
            nova@to.email.ne.jp Hideaki Nobata
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: