summaryrefslogtreecommitdiff
path: root/rust/src/low_level_il/function.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-05-31 10:45:26 -0400
committerMason Reed <mason@vector35.com>2025-05-31 10:45:26 -0400
commit8ba8388e12ab32ad937c4514f7a907d2530f1ef8 (patch)
tree6f63abc4605b7429a7e215eef0769d72ab0fb97a /rust/src/low_level_il/function.rs
parentc7a819799828e965b6c2afa7e8f39aecf1a5b9a7 (diff)
[Rust] Retrieve architecture if missing from location passed to `MediumLevelILFunction::instruction_from_index`
Fixes https://github.com/Vector35/binaryninja-api/issues/6876
Diffstat (limited to 'rust/src/low_level_il/function.rs')
-rw-r--r--rust/src/low_level_il/function.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/rust/src/low_level_il/function.rs b/rust/src/low_level_il/function.rs
index 8af89652..2eaf7f11 100644
--- a/rust/src/low_level_il/function.rs
+++ b/rust/src/low_level_il/function.rs
@@ -106,7 +106,8 @@ where
) -> Option<LowLevelInstructionIndex> {
use binaryninjacore_sys::BNLowLevelILGetInstructionStart;
let loc: Location = loc.into();
- let arch = loc.arch.unwrap_or_else(|| *self.arch().as_ref());
+ // If the location does not specify an architecture, use the function's architecture.
+ let arch = loc.arch.unwrap_or_else(|| self.arch());
let instr_idx =
unsafe { BNLowLevelILGetInstructionStart(self.handle, arch.handle, loc.addr) };
// `instr_idx` will equal self.instruction_count() if the instruction is not valid.