lysis-java icon indicating copy to clipboard operation
lysis-java copied to clipboard

Logic chain decompilation error

Open devilesk opened this issue 4 years ago • 0 comments

Example code:

public FuncA()
{
    if (((0 > 0 && 0 <= MaxClients) && 1) && 1) {
		return;
    }
}

public FuncB()
{
    if ((0 > 0 && 0 <= MaxClients) && 1 && 1) {
		return;
    }
}

public FuncC()
{
    if (((0 > 0 && 0 <= MaxClients) && 1)) {
		return;
    }
}

FuncB and FunC decompile but FuncA shows

/* ERROR! class lysis.nodes.types.DReturn cannot be cast to class lysis.nodes.types.DJump (lysis.nodes.types.DReturn and lysis.nodes.types.DJump are in unnamed module of loader 'app') */
 function "FuncA" (number 1)

And this is the error from the command line:

java.lang.ClassCastException: class lysis.nodes.types.DReturn cannot be cast to class lysis.nodes.types.DJump (lysis.nodes.types.DReturn and lysis.nodes.types.DJump are in unnamed module of loader 'app')
        at lysis.builder.structure.SourceStructureBuilder.SingleTarget(SourceStructureBuilder.java:84)
        at lysis.builder.structure.SourceStructureBuilder.buildLogicChain(SourceStructureBuilder.java:131)
        at lysis.builder.structure.SourceStructureBuilder.traverseComplexIf(SourceStructureBuilder.java:271)
        at lysis.builder.structure.SourceStructureBuilder.traverseIf(SourceStructureBuilder.java:359)
        at lysis.builder.structure.SourceStructureBuilder.traverseBlockNoLoop(SourceStructureBuilder.java:598)
        at lysis.builder.structure.SourceStructureBuilder.traverseBlock(SourceStructureBuilder.java:632)
        at lysis.builder.structure.SourceStructureBuilder.build(SourceStructureBuilder.java:636)
        at lysis.Lysis.DumpMethod(Lysis.java:132)
        at lysis.Lysis.main(Lysis.java:198)

The only difference between FuncA and FuncB is an extra set of parentheses and the only difference between FuncA and FuncC is another term at the end.

For context, I'm trying to decompile a plugin compiled from this source and logic statements like in my example show up in the two IS_VALID_SURVIVOR calls (1, 2)

Another example that generates the same error:

public FuncD()
{
    new bool:x = ((0 > 0 && 0 <= MaxClients) && 1) && 1;
}

devilesk avatar Oct 06 '20 18:10 devilesk