[ 
https://issues.apache.org/jira/browse/BCEL-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14353391#comment-14353391
 ] 

Mark Roberts commented on BCEL-79:
----------------------------------

I have created a test case that demonstrates the failure of the current code.  
(As noted above, most of the locals are incorrectly discarded; local var count 
goes from 4 to 1.)

In the process, I realized that most of the implementation for 
LocalVariableTypeTable is just wrong.  It assumes that LocalVariables and 
LocalVariableTypes are equivalent, if you have one you don't need the other.  
Also, it assumes that descriptors and signatures are equivalent.   If you 
uncomment out the indicated line in the test, you will see BCEL crash due to 
this fact.

In addition, there is no way for a user to inspect the LocalVariableTypeTable.  
The only getLocalVariableTypeTable() method is in LocalVariableTypeTable - 
pretty nifty Catch 22.

> java.lang.ClassFormatError: LVTT entry for 'local' in class file 
> org/shiftone/jrat/test/dummy/CrashTestDummy does not match any LVT entry
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: BCEL-79
>                 URL: https://issues.apache.org/jira/browse/BCEL-79
>             Project: Commons BCEL
>          Issue Type: Bug
>          Components: Main
>            Reporter: Jeff Drost
>            Assignee: Apache Commons Developers
>            Priority: Blocker
>             Fix For: 6.0
>
>         Attachments: PLSETestCase.java, bcel-patch-method.txt
>
>
> I have tried both the release at http://people.apache.org/~tcurdt/bcel/rc2/ , 
> as
> well as a build from head (410655).  I see the same ClassFormatError with 
> both.
> I get this error when running a JRat test case.  This project and the test 
> case
> is avalible on sourceforge (http://sourceforge.net/projects/jrat) - or I can
> provide it directly.  The test case uses BCEL to isntrument a class and then
> tries to execute methods various methods on it.
> see org.shiftone.jrat.test.InjectorTestCase
> java.lang.ClassFormatError: LVTT entry for 'local' in class file
> org/shiftone/jrat/test/dummy/CrashTestDummy does not match any LVT entry
>       at java.lang.ClassLoader.defineClass1(Native Method)
>       at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
>       at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
>       at 
> org.shiftone.jrat.test.TestClassLoader.loadClass(TestClassLoader.java:36)
>       at 
> org.shiftone.jrat.test.InjectorTestCase.setUp(InjectorTestCase.java:52)
>       at 
> com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to