DO NOT REPLY [Bug 39911] New: - BCEL 5.2 - MethodGen does not initialize max_stack and max_locals properly

[email protected]
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=39911>.
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=39911

           Summary: BCEL 5.2 - MethodGen does not initialize max_stack and
                    max_locals properly
           Product: BCEL
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Main
        AssignedTo: [email protected]
        ReportedBy: [email protected]


The constructor for MethodGen:

public MethodGen(Method, String, ConstantPoolGen)

does not properly initialize the max_stack and max_local variables from the
Method object. Thus the following sequence of actions will produce a
non-verifying class, even though it clearly shouldn't:

ClassGen cg = new ClassGen(javaClass);
Method m = cg.getMethodAt(0);
MethodGen mg = new MethodGen(m, cg.getClassName(), cg.getConstantPool());
cg.setMethodAt(mg.getMethod(), 0);
cg.getJavaClass().dump(...);

Bug can be fixed by adding the following the constructor:

Code c = m.getCode();
max_stack = c.getMaxStack();
max_locals = c.getMaxLocals();

-- 
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.