diff options
| author | Brian Potchik <brian@vector35.com> | 2021-04-19 15:39:33 -0400 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2021-04-19 15:39:33 -0400 |
| commit | 224e24b283b8be99415431856e6b63dea7305996 (patch) | |
| tree | 96440f2c02cc012ad625bcded8b0c64c2759b785 /rust/src/binaryview.rs | |
| parent | 0d52013908d977a12c35e6a03226a90107321c63 (diff) | |
Fix Mach-O duplicate symbol handling for external relocations.
Diffstat (limited to 'rust/src/binaryview.rs')
| -rw-r--r-- | rust/src/binaryview.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/rust/src/binaryview.rs b/rust/src/binaryview.rs index 528e3374..c5df4f61 100644 --- a/rust/src/binaryview.rs +++ b/rust/src/binaryview.rs @@ -385,12 +385,18 @@ pub trait BinaryViewExt: BinaryViewBase { }; unsafe { - BNDefineAutoSymbolAndVariableOrFunction( + let raw_sym = BNDefineAutoSymbolAndVariableOrFunction( self.as_ref().handle, plat.handle, sym.handle, raw_type, ); + + if raw_sym.is_null() { + return Err(()); + } + + Ok(Ref::new(Symbol::from_raw(raw_sym))) } } |
