You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling metal::Buffer.label() panics if there is no label set. In my opinion, it should return an Option<&str> instead, or the empty string if you're looking to avoid a breaking API change.
My code panics with the following message:
unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX`
...
6: metal::nsstring_as_str
at /Users/ian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/metal-0.31.0/src/lib.rs:74:21
Also, if we look at the docs for UTF8String we can see this warning:
This C string is a pointer to a structure inside the string object, which may have a lifetime shorter than the string object and will certainly not have a longer lifetime. Therefore, you should copy the C string if it needs to be stored outside of the memory context in which you use this property.
This makes me worried that the library's approach to handling NSStrings can lead to use after frees.
The text was updated successfully, but these errors were encountered:
Calling metal::Buffer.label() panics if there is no label set. In my opinion, it should return an Option<&str> instead, or the empty string if you're looking to avoid a breaking API change.
My code panics with the following message:
Looking at the implementation we see:
There is no check that bytes is not null.
Also, if we look at the docs for UTF8String we can see this warning:
This makes me worried that the library's approach to handling NSStrings can lead to use after frees.
The text was updated successfully, but these errors were encountered: