Skip to content

[BUG] Vmify in certain conditions produces code that randomly stops working #71

Description

@dragonbane0

Describe the bug
As best as I can tell is that too many control structures (if, for) is a struggle as soon as the virtual machine (Vmify) setting is enabled. It took me a long while to make a script that can reliably re-produce the issue without containing any sensitive code (see at the bottom).

My more complex scripts will encounter this bug often. It manifests in that execution stops right when a nested control structure in a table function is supposed to end. A print at the end of the affected control structure will still go through, right outside after it will no longer happen. Call stack doesn't seem to matter, the function is inherently broken. No exception is fired either.

If you move the function around in the file, so will the issue shift to a different place in the code (or sometimes no longer happen). Removing a single if control block anywhere in the file can also fix the issue or move it to a different place. However the amount of code inside the control structures seems to have no effect on the bug (as long as you don't add more control structures that is).

Expected behavior
That even more complex scripts don't have this issue with control structures as soon as you use Vmify.

To Reproduce
Use the following nonsense script and note how you get 3 logs unobfuscated: "Pre bug", "For loop" and "Post bug". Now obfuscate the script with the Vmify, ConstantArray, NumbersToExpressions and WrapInFunction setting and find that now only the first 2 logs fire and the last one never happens. Leave out the Vmify setting and it all works fine. Even using the Vmify setting standalone already causes the bug.

The source script: https://pastebin.com/6vtiNN6t
The obfuscated broken script: https://pastebin.com/9yVSSbSy
The config settings: https://pastebin.com/jCxEGGBF

Additional context
Lua 5.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions