leibnitz27 / cfr

This is the public repository for the CFR Java decompiler
https://www.benf.org/other/cfr
MIT License
1.93k stars 249 forks source link

CFR may mix value '0' and 'false' in a invalid way #330

Open AIRTEspresso opened 1 year ago

AIRTEspresso commented 1 year ago

CFR version

CFR version: 0.152

Compiler

Java openJDK, version: 11.0.13

Description

Here is another case that CFR may generate invalid Java code. In this example, CFR may mix value '0' and 'false', would you like to have a look? The total case is available at error example and I hope it can be helpful.

Example

The source code:

        int i20 = 35;
        boolean bArr1[]= new boolean[N];
        switch(30){
            case 32 : {
                boolean b2 = false;
                bArr1[i20]= b2;
            }
            short s1 = 31371;
        }

The code decompiled by CFR:

        int n = 35;
        boolean[] blArray = new boolean[this.N];
        switch (30) {
            case 32: {
                int n2;
                blArray[n] = n2 = 0;
                n2 = 31371;
            }
        }