diff options
| author | Mark Rowe <mrowe@bdash.net.nz> | 2025-05-11 07:04:35 -0700 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2025-05-12 17:45:24 -0400 |
| commit | 0f0321bb94358b807fee1ba7a546f0762bf9785e (patch) | |
| tree | 3738625911f32b04592f7335d1f8318120276772 /rust/src/medium_level_il/lift.rs | |
| parent | e901a6a4ce4aff281b46ef87363b8c56d35f70af (diff) | |
[Rust] Don't panic when a Rust plug-in encounters an unhandled MLIL instruction
`MediumLevelILInstruction` does not yet handle `MLIL_CALL_OUTPUT`,
`MLIL_CALL_PARAM`, `MLIL_CALL_PARAM_SSA`, `MLIL_CALL_OUTPUT_SSA`,
`MLIL_MEMORY_INTRINSIC_OUTPUT_SSA`, or `MLIL_MEMORY_INTRINSIC_SSA`. Map
these to a `NotYetImplemented` kind rather than panicking since a panic
takes down the entire app.
Diffstat (limited to 'rust/src/medium_level_il/lift.rs')
| -rw-r--r-- | rust/src/medium_level_il/lift.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/rust/src/medium_level_il/lift.rs b/rust/src/medium_level_il/lift.rs index 3f161484..f5ee45b3 100644 --- a/rust/src/medium_level_il/lift.rs +++ b/rust/src/medium_level_il/lift.rs @@ -175,6 +175,9 @@ pub enum MediumLevelILLiftedInstructionKind { VarSsaField(VarSsaField), VarAliasedField(VarSsaField), Trap(Trap), + // A placeholder for instructions that the Rust bindings do not yet support. + // Distinct from `Unimpl` as that is a valid instruction. + NotYetImplemented, } impl MediumLevelILLiftedInstruction { @@ -186,6 +189,7 @@ impl MediumLevelILLiftedInstruction { Bp => "Bp", Undef => "Undef", Unimpl => "Unimpl", + NotYetImplemented => "NotYetImplemented", If(_) => "If", FloatConst(_) => "FloatConst", Const(_) => "Const", @@ -318,7 +322,7 @@ impl MediumLevelILLiftedInstruction { use MediumLevelILLiftedInstructionKind::*; use MediumLevelILLiftedOperand as Operand; match &self.kind { - Nop | Noret | Bp | Undef | Unimpl => vec![], + Nop | Noret | Bp | Undef | Unimpl | NotYetImplemented => vec![], If(op) => vec