From bc5e0b8ba9520d560bb07ee298047c7880b879ff Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Tue, 20 Jan 2026 14:32:14 -0800 Subject: [Rust] Add `Platform::address_size` --- rust/src/platform.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'rust') 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` -- cgit v1.3.1