function that expects std::string?
When I'm passing CString the c++ functions tell that the string is empty
☠☠☠
😐
There's no interop between Rust and C++, especially STL, you need to use a C layer in-between them. Check out this video for more information why https://youtu.be/RxtXGeDHu0w
If it's a String in Rust, then they both want to "manage" it
Rust wants to allocate, resize, and free its String C++ wants to allocate, resize, and free its std::string And they both have internal representations on how to store capacity and length etc
Eventually I passed raw_parts instead of as_ptr and that way c++ could use it even after the rust function return
Sounds like use after free but okay
Unfortunately Rust is very unreadable without IDE
The author of the cpp library told me that he wrote the lib in a way that I can free things that passed into it
So I can't really tell if it's UAF
That doesn't matter if it's already freed, would still be UAF
I mean, from rust side it won't free. that's why I used raw_parts
cxx-rs?
I don't know why, rust mysteries :)
Обсуждают сегодня