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
This commit is contained in:
parent
c88417a3b6
commit
9716918517
|
@ -63,7 +63,7 @@ impl<'lua> Debug<'lua> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Corresponds to the `n` what mask.
|
/// Corresponds to the `n` what mask.
|
||||||
pub fn names(&self) -> DebugNames<'lua> {
|
pub fn names(&self) -> DebugNames {
|
||||||
unsafe {
|
unsafe {
|
||||||
#[cfg(not(feature = "luau"))]
|
#[cfg(not(feature = "luau"))]
|
||||||
mlua_assert!(
|
mlua_assert!(
|
||||||
|
@ -87,7 +87,7 @@ impl<'lua> Debug<'lua> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Corresponds to the `S` what mask.
|
/// Corresponds to the `S` what mask.
|
||||||
pub fn source(&self) -> DebugSource<'lua> {
|
pub fn source(&self) -> DebugSource {
|
||||||
unsafe {
|
unsafe {
|
||||||
#[cfg(not(feature = "luau"))]
|
#[cfg(not(feature = "luau"))]
|
||||||
mlua_assert!(
|
mlua_assert!(
|
||||||
|
|
Loading…
Reference in New Issue