diff options
| author | Mason Reed <mason@vector35.com> | 2025-05-30 16:42:48 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-05-30 19:17:10 -0400 |
| commit | 032080750a88a1a437784b8c95cb1747aa907d0c (patch) | |
| tree | 41ee52ebc168a725217e8caf9bb68315eeb80d10 /rust/src/medium_level_il/function.rs | |
| parent | 68b00cdf45551ba64c4f7217963055fc5a1a0cc4 (diff) | |
[Rust] Finish out the `PossibleValueSet` implementation to include range and lists of values
This requires us to allocate on the rust side of the API, this is quite easy to mess up but the usage of it is limited.
Diffstat (limited to 'rust/src/medium_level_il/function.rs')
| -rw-r--r-- | rust/src/medium_level_il/function.rs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/rust/src/medium_level_il/function.rs b/rust/src/medium_level_il/function.rs index 8751111b..4206f7dd 100644 --- a/rust/src/medium_level_il/function.rs +++ b/rust/src/medium_level_il/function.rs @@ -183,7 +183,7 @@ impl MediumLevelILFunction { /// Allows the user to specify a PossibleValueSet value for an MLIL /// variable at its definition site. /// - /// .. warning:: Setting the variable value, triggers a reanalysis of the + /// WARNING: Setting the variable value, triggers a reanalysis of the /// function and allows the dataflow to compute and propagate values which /// depend on the current variable. This implies that branch conditions /// whose values can be determined statically will be computed, leading to @@ -212,23 +212,15 @@ impl MediumLevelILFunction { value: PossibleValueSet, after: bool, ) -> Result<(), ()> { - let Some(_def_site) = self - .var_definitions(var) - .iter() - .find(|def| def.address == addr) - else { - // Error "No definition for Variable found at given address" - return Err(()); - }; let function = self.function(); let def_site = BNArchitectureAndAddress { arch: function.arch().handle, address: addr, }; let raw_var = BNVariable::from(var); - let raw_value = PossibleValueSet::into_raw(value); + let raw_value = PossibleValueSet::into_rust_raw(value); unsafe { BNSetUserVariableValue(function.handle, &raw_var, &def_site, after, &raw_value) } - PossibleValueSet::free_owned_raw(raw_value); + PossibleValueSet::free_rust_raw(raw_value); Ok(()) } |
