-
Notifications
You must be signed in to change notification settings - Fork 194
Rhai is unsound (use after free) #894
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
I'm outside right now but on the surface it looks legit... Why do you say therr is OB? |
Ah I see it now. The Sneaky... I must have a way to distinguish between |
So far I have not been able to find a way to avoid the user passing in That's because, to the Rust compiler, lifetimes do not form part of a type's ID. Therefore, it merrily thinks that |
Do you have any reason to allow registered functions take any non- |
Well, non- Therefore, I'm free to assume that, as long as the reference passed into the function outlives the function call, everything is OK. Except that if that reference is It is only with |
FYI, this seems like the same issue in rune-rs/rune#601 I'm mentioning it here so you can consider the same remedy which is to bind local references using HRTBs. |
Thanks @udoprog for the tip. I have looked into the PR and I'm not sure what you mean by HRTB since I don't seem to find them in the code. It seems to be disallowing reference parameters altogether... Any pointer is appreciated! Also, great job on Rune which seems to keep getting better! |
This is the relevant commit: rune-rs/rune@ce81e69 Here's a playground which might make it clearer: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=0edc3aa181f03772f7c48a9c41985630 Of particular interest is an implementation like Note that this causes an issue in the number of implementations that have to be present, since it's a permutation between owned, |
Uh oh!
There was an error while loading. Please reload this page.
Consider the following example:
rhai v1.19.0
The text was updated successfully, but these errors were encountered: