You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There appears to be an error decompiling a small program. I am doing some work using Java bytecode, so I’m conscious that this is not a ‘normal’ Java program and therefore may be outside of the scope of CFR! In particular it has some spicy control flow. But it would be interesting to know what is causing the issue since some minor changes to the program (that do not eliminate the weird control flow) result in a correctly decompiled program.
In the original program, the first switch statement has a case 0 that jumps to block_2. In the decompiled program, the first switch statement only has case 1 and case 2.
I attempted to simplify the example program further to pinpoint the source of the issue, but it either resolves (e.g. removing the switch case 2 in the first switch statement results in correct decompilation), or fails to decompile. I will report the related failed decompilation example separately in case it is useful for diagnostics.
Excerpt from bytecode program (full files for reproduction are attached below):
To illustrate the issue, I attach some small programs that call the function in its original and decompiled form and prints the contents of the output array. In the original function the output array contains [0, 2] after the function call, while in the decompiled version the output array contains [0, 1].
TestCase.j is the original java bytecode program
TestCase.class is the compiled class file from TestCase.j
TestCase.java is the decompiled output from CFR
Wrapper.java is a wrapper program to show the output from the original and decompiled programs
example.sh a shell script with the steps for running the original and decompiled examples
Edit the paths in lines 1 and 2 of the shell script as appropriate
Run the script; you should see [0, 2] as output from the original program and [0, 1] as output from the de- and re-compiled program indicating the missing switch case
The text was updated successfully, but these errors were encountered:
CFR version
CFR 0.153-SNAPSHOT (3d1d0f4)
Compiler
OpenJDK 19.0.2 on Ubuntu 22.04
Description
There appears to be an error decompiling a small program. I am doing some work using Java bytecode, so I’m conscious that this is not a ‘normal’ Java program and therefore may be outside of the scope of CFR! In particular it has some spicy control flow. But it would be interesting to know what is causing the issue since some minor changes to the program (that do not eliminate the weird control flow) result in a correctly decompiled program.
In the original program, the first switch statement has a case 0 that jumps to block_2. In the decompiled program, the first switch statement only has case 1 and case 2.
I attempted to simplify the example program further to pinpoint the source of the issue, but it either resolves (e.g. removing the switch case 2 in the first switch statement results in correct decompilation), or fails to decompile. I will report the related failed decompilation example separately in case it is useful for diagnostics.
Excerpt from bytecode program (full files for reproduction are attached below):
Corresponding excerpt from decompiled program, with comments indicating the relevant switch case added by me:
Example
example.zip
To illustrate the issue, I attach some small programs that call the function in its original and decompiled form and prints the contents of the output array. In the original function the output array contains
[0, 2]
after the function call, while in the decompiled version the output array contains[0, 1]
.TestCase.j
is the original java bytecode programTestCase.class
is the compiled class file fromTestCase.j
TestCase.java
is the decompiled output from CFRWrapper.java
is a wrapper program to show the output from the original and decompiled programsexample.sh
a shell script with the steps for running the original and decompiled examplesTo run:
[0, 2]
as output from the original program and[0, 1]
as output from the de- and re-compiled program indicating the missing switch caseThe text was updated successfully, but these errors were encountered: