jakarta-bcel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 45230] New: tableswitch/ lookupswitch invalid alignment of 4-byte operands
Date Wed, 18 Jun 2008 22:23:31 GMT

           Summary: tableswitch/lookupswitch invalid alignment of 4-byte
           Product: BCEL
           Version: 5.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main
        AssignedTo: bcel-dev@jakarta.apache.org
        ReportedBy: talper@coverity.com

Created an attachment (id=22137)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22137)
Testcase: sample application that reproduces the bug

It is possible, with BCEL, to generate invalid alignment of the 4-byte operands
of the Select instructions. The problem is caused by the interaction of
InstructionList.setPositions, the updatePosition methods of GOTO and JSR, and

In particular, the updatePosition methods of GOTO and JSR will always return
the difference between the wide instruction length and the normal instruction
length. Since this value ends up being added into the additional_bytes variable
in InstructionList.setPositions and then eventually contributes to the value
passed into Select.updatePosition as the offset, its incorrect value causes the
padding field to be set incorrectly.

It appears that in order to behave properly, the updatePosition method should
return only the number of bytes of length that the instruction changed during
this call to updatePosition.

I am attaching a small example application that displays the bug.

I will also be attaching a patch.

Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org

View raw message