diff options
author | Alex Orlenko <zxteam@protonmail.com> | 2022-12-09 23:55:38 +0000 |
---|---|---|
committer | Alex Orlenko <zxteam@protonmail.com> | 2022-12-09 23:55:38 +0000 |
commit | 97169185175c52f87fe64d004980105adadc1998 (patch) | |
tree | ea0b2e418720d831c95df92a3696d61ef2b57e08 | |
parent | c88417a3b6585885d069ff9043cc54e799fbcb33 (diff) | |
download | mlua-97169185175c52f87fe64d004980105adadc1998.zip |
Fix lifetime of `DebugNames` in `Debug::names()` and `DebugSource` in `Debug::source()`.
This can cause use-after-free if used wrong.
Now invalid code would not compile.
Reported in #230
-rw-r--r-- | src/hook.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hook.rs b/src/hook.rs index 59d67ae..f52fec3 100644 --- a/src/hook.rs +++ b/src/hook.rs @@ -63,7 +63,7 @@ impl<'lua> Debug<'lua> { } /// Corresponds to the `n` what mask. - pub fn names(&self) -> DebugNames<'lua> { + pub fn names(&self) -> DebugNames { unsafe { #[cfg(not(feature = "luau"))] mlua_assert!( @@ -87,7 +87,7 @@ impl<'lua> Debug<'lua> { } /// Corresponds to the `S` what mask. - pub fn source(&self) -> DebugSource<'lua> { + pub fn source(&self) -> DebugSource { unsafe { #[cfg(not(feature = "luau"))] mlua_assert!( |