DO NOT REPLY [Bug 43367] New: - MethodGen.setMaxLocals() calculates too small max locals, which results in a ClassFormatError when loading the modified class

[email protected] Wed, 12 Sep 2007 08:21:06 -0700 (PDT)
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]/bugzilla/>
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43367>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43367

           Summary: MethodGen.setMaxLocals() calculates too small max
                    locals, which results in a ClassFormatError when loading
                    the modified class
           Product: BCEL
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Revision 574984 (trunk)

When a local variable is added to a method, the max_locals are incremented in
addLocalVariable (set to slot + size of type).
However, when no other transformations are made, and setMaxLocals() is called,
the bytecode is searched for the max variable index, and max_locals set to that
index + size of that entry. The old max_locals which was set by adding the field
is overwritten by this number.

If the LocalVariableTable for that method exists, the Java VM won't load the
class, because the max_locals determined by bcel is smaller than the max locals
determined from the localvariabletable => ClassFormatException.

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