Skip to content

Commit 7b41924

Browse files
committed
Fix registration of Rust arch plugins with context
1 parent 8922a98 commit 7b41924

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

rust/src/architecture.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,14 @@ impl FunctionLifterContext {
673673
let mut auto_indirect_branches: HashMap<Location, HashSet<Location>> = HashMap::new();
674674
for i in 0..flc_ref.indirectBranchesCount {
675675
let entry = unsafe { *flc_ref.indirectBranches.add(i) };
676-
let src = Location::new(Some(CoreArchitecture::from_raw(entry.sourceArch)), entry.sourceAddr);
677-
let dest = Location::new(Some(CoreArchitecture::from_raw(entry.destArch)), entry.destAddr);
676+
let src = Location::new(
677+
Some(CoreArchitecture::from_raw(entry.sourceArch)),
678+
entry.sourceAddr,
679+
);
680+
let dest = Location::new(
681+
Some(CoreArchitecture::from_raw(entry.destArch)),
682+
entry.destAddr,
683+
);
678684
if entry.autoDefined {
679685
auto_indirect_branches
680686
.entry(src)
@@ -2738,7 +2744,6 @@ where
27382744

27392745
unsafe {
27402746
let res = BNRegisterArchitecture(name.as_ptr(), &mut custom_arch as *mut _);
2741-
27422747
assert!(!res.is_null());
27432748

27442749
(*raw).arch.assume_init_mut()
@@ -2814,7 +2819,8 @@ where
28142819
true
28152820
}
28162821

2817-
register_architecture_impl(name, func, |custom_arch| {
2822+
2823+
return register_architecture_impl(name, func, |custom_arch| {
28182824
custom_arch.freeFunctionArchContext = Some(cb_free_function_arch_context_typed::<A>);
28192825
custom_arch.getInstructionTextWithContext =
28202826
Some(cb_get_instruction_text_with_context_typed::<A>);

0 commit comments

Comments
 (0)