Description
Version and Platform (required):
- Binary Ninja Version: 5.1.7320-dev (aa12054b)
- OS: macOS 15.4.1
- CPU Architecture: arm64
Bug Description:
BnString::as_str
panics if the underlying string is not valid UTF-8. Many of these strings come from core which does not make any guarantees about their UTF-8ness. Symbol names, for instance, may not be valid UTF-8.
BnString
is described as being analogous to CString
. The similar methods on CString
are failable:
pub fn into_string(self) -> Result<String, IntoStringError>
pub fn to_str(&self) -> Result<&str, Utf8Error>
IMO BnString::as_str
should return Result
and let the caller unwrap()
if that's what they want.
It might be worth renaming as_str
to to_str
to match the naming on CStr
.