TheDan64 / inkwell

It's a New Kind of Wrapper for Exposing LLVM (Safely)
https://thedan64.github.io/inkwell/
Apache License 2.0
2.38k stars 229 forks source link

Inkwell crashes in LLVM if receiving NULL-terminated string #533

Closed vosen closed 2 months ago

vosen commented 2 months ago

Describe the Bug If BasicValueEnum::set_name receives NULL-terminated string it crashes in LLVM assert that checks strings for NULL-termination

To Reproduce

            let value = fn_.get_nth_param(0 as u32).unwrap();
            value.set_name("asdf\0");

Expected Behavior I expect BasicValueEnum::set_name(...) to either not include terminating NULL when passing string to LLVMSetValueName2(...) or just not accept NULL-terminated strings at all

LLVM Version (please complete the following information):