diff options
| author | Mason Reed <mason@vector35.com> | 2026-01-20 14:32:14 -0800 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2026-03-23 21:50:02 -0700 |
| commit | bc5e0b8ba9520d560bb07ee298047c7880b879ff (patch) | |
| tree | e9d059dba425e48720665656814cf501f0824bd0 | |
| parent | 75f4b939c656cc53ab7ecfb8b24af7fcb6961d10 (diff) | |
[Rust] Add `Platform::address_size`
| -rw-r--r-- | rust/src/platform.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/rust/src/platform.rs b/rust/src/platform.rs index 43548032..46129b81 100644 --- a/rust/src/platform.rs +++ b/rust/src/platform.rs @@ -165,6 +165,12 @@ impl Platform { unsafe { CoreArchitecture::from_raw(BNGetPlatformArchitecture(self.handle)) } } + /// Get the address size of the platform, this is typically the same as the architecture's address size, + /// but some platforms like Linux x86_64 x32 ABI have differing address sizes from architecture. + pub fn address_size(&self) -> usize { + unsafe { BNGetPlatformAddressSize(self.handle) } + } + pub fn type_container(&self) -> TypeContainer { let type_container_ptr = NonNull::new(unsafe { BNGetPlatformTypeContainer(self.handle) }); // NOTE: I have no idea how this isn't a UAF, see the note in `TypeContainer::from_raw` |
