You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by bu...@apache.org on 2007/09/12 17:21:06 UTC

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

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: bcel-dev@jakarta.apache.org
        ReportedBy: erich.hochmuth@dynatrace.com


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.

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


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

Posted by bu...@apache.org.
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





------- Additional Comments From erich.hochmuth@dynatrace.com  2007-09-13 03:38 -------
Created an attachment (id=20810)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20810&action=view)
Example how to reproduce the issue.

Start the Reproducer with java -cp bcel.jar:. Reproducer - the example
instrument the constructor of it's own class, adds a field, and tries to load
the modified class.

-- 
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.

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