-
Notifications
You must be signed in to change notification settings - Fork 72
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
[BUG] Vmify in certain conditions produces code that randomly stops working #71
Comments
I will work on this asap. This is probably due to some small typo in compiler.lua At least other fixed bugs that caused random crashes that got worse with bigger programs were due to typos. |
Not sure if you deleting your reply means you managed to re-create it after all, but just for extra context I would like to confirm that I do use the latest Prometheus release v0.2.3 (using the source code version with a Lua 5.1 Windows compiler) and it happens on that. I was running into issues with the first alpha release too, but I figured there was no use in reporting those, so I've made sure to upgrade to latest beforehand. It's indeed very finicky though and one random change can "fix" or move the bug entirely. |
Maybe this bug is the related to lua5.1, because using luajit I can't reproduce this. I will try Lua 5.1 tomorrow |
Yep. Just compiled it with luajit and the bug doesn't happen at that specific point. There is also a notable file size increase of 8 KB going from lua5.1 to luajit despite identical settings and seed. Until you can check further I'm not going to say that the bug is completely fixed, compiling with luajit might just move it to a different place yet again. I will try compiling some of my original more complex scripts again tomorrow and see if luajit makes them all come out completely okay. |
The size increase may be, because lua5.1 uses a diferent implementation for math.random. |
Looks like there might still be some issues with luajit as well. At least 2 of my lua files obfuscated individually worked fine, but put together into the same file had issues. Will try to narrow that down and see if it is related or something else |
Coudn't really narrow it down last time I looked, so hopefully it will be figured out eventually why larger files have issues like this |
when executing on luajit sometimes if the file is too big it throws "control structure too long near 'end'" |
Is this still happening or it can be closed? @levno-710 |
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
The text was updated successfully, but these errors were encountered: