Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logic chain decompilation error #25

Open
devilesk opened this issue Oct 6, 2020 · 0 comments
Open

Logic chain decompilation error #25

devilesk opened this issue Oct 6, 2020 · 0 comments
Labels

Comments

@devilesk
Copy link

devilesk commented Oct 6, 2020

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;
}
@peace-maker peace-maker added the bug label Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants