Skip to content

ezlua is unsound #5

@devzf

Description

@devzf

Consider the following example:

use ezlua::prelude::*;

fn main() {
    let lua = Lua::with_open_libs();

    let st = std::rc::Rc::new(std::cell::RefCell::new(None));
    let st2 = st.clone();
    let f = lua
        .new_closure(move |s: LuaString<'static>| {
            st2.borrow_mut().replace(s);
        })
        .unwrap();
    lua.global().set("f", f).unwrap();
    lua.do_string("f('')", None).unwrap();

    let s = st.borrow();
    println!("{:?}", s.as_ref().map(|s| s.to_str()));
}

ezlua v0.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions