-
Notifications
You must be signed in to change notification settings - Fork 245
Labels
Component: Python APIIssue needs changes to the python APIIssue needs changes to the python APIComponent: Rust APIIssue needs changes to the Rust APIIssue needs changes to the Rust APIEffort: MediumIssue should take < 1 monthIssue should take < 1 monthImpact: MediumIssue is impactful with a bad, or no, workaroundIssue is impactful with a bad, or no, workaround
Milestone
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
.
Metadata
Metadata
Assignees
Labels
Component: Python APIIssue needs changes to the python APIIssue needs changes to the python APIComponent: Rust APIIssue needs changes to the Rust APIIssue needs changes to the Rust APIEffort: MediumIssue should take < 1 monthIssue should take < 1 monthImpact: MediumIssue is impactful with a bad, or no, workaroundIssue is impactful with a bad, or no, workaround