lua-patterns
lua-patterns copied to clipboard
Exposing Lua string patterns to Rust
TL;DR: my code crashes if I remove unrelated `printf`, and `cargo miri` complains, which together look very much like some UB in unsafe code. I haven't yet dug into this,...
Investigating https://github.com/stevedonovan/lua-patterns/issues/2 more, it sees like this repository doesn't contain the latest verison, published to crates.io.
In lua, there's \0 at the end, but we don't have one, so *ep is UB
``` use lua_patterns::LuaPattern; fn main() { let mut m = LuaPattern::from_bytes(&[160]); let s = "⚠"; s.bytes().for_each(|b| println!("{}" , b)); m.gsub(s , ""); } ``` The ⚠ is made up of...