-
Notifications
You must be signed in to change notification settings - Fork 117
Loading and running bytecode #145
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
Comments
The reason for that is that it's potential UB and needs a separate unsafe interface, which I've yet to add. |
I'm not sure why executing bytecode is considered so insecure? It's part of Lua and is no more or less secure than running arbitrary Lua scripts. Running scripts or bytecode from any insecure resource is a security risk, whether compiled or not. Obviously, scripts allow you to read the content, but that's not really relevant for me. Having precompiled content significantly speeds up what I'm trying to do. |
It's not that it's insecure, it's that it's actually UB if the bytecode is malformed. As I understand it, there's no bounds checking on the indexes in the bytecode, so if the bytecode is corrupted or something it will just exhibit UB. I'm not saying you shouldn't have the ability to do this, I'm just saying it needs a separate unsafe function to do it. If you really need to do this right now you can do it by going through lua's This is sort of related to #116, I just haven't had time lately to actually sit down and solve all of this. |
ah ok, I get it. Thanks for the response. I think I will load the file from the file system for now using loadfile. :-) Many thanks. |
Hi,
I have been trying to run some bytecode using this:
let mut f = File::open("C:\Users\kkp\Documents\Rust\server_host\src\out.luac").unwrap();
let mut buffer = Vec::new();
f.read_to_end(&mut buffer);
lua_ctx.load(&*buffer).exec().is_err();
but I can't get it to work. Do you have any idea how to execute pre-compiled bytecode from a file?
The text was updated successfully, but these errors were encountered: