From 47e0f1f685119ebffecbb99d2cce35c53a384738 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Tue, 26 Aug 2025 23:43:32 -0400 Subject: [WARP] Fix generating lifted IL when function GUID is already cached We do not need to consult the lifted IL if we have already cached the function GUID in the function metadata --- plugins/warp/src/lib.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'plugins/warp/src/lib.rs') diff --git a/plugins/warp/src/lib.rs b/plugins/warp/src/lib.rs index be6f8bc3..56915983 100644 --- a/plugins/warp/src/lib.rs +++ b/plugins/warp/src/lib.rs @@ -106,13 +106,18 @@ pub fn build_variables(func: &BNFunction) -> Vec { } // TODO: Get rid of the minimal bool. +/// Build the WARP [`Function`] from the Binary Ninja [`BNFunction`]. +/// +/// The `lifted_il_accessor` is passed in such that a function with a guid already cached will not +/// require us to regenerate the IL. This is important in the event of someone generating signatures +/// off of an existing BNDB or when the IL is no longer present. pub fn build_function( func: &BNFunction, - lifted_il: &LowLevelILFunction, + lifted_il_accessor: impl Fn() -> Option>>, minimal: bool, -) -> Function { +) -> Option { let mut function = Function { - guid: cached_function_guid(func, lifted_il), + guid: cached_function_guid(func, lifted_il_accessor)?, symbol: from_bn_symbol(&func.symbol()), // NOTE: Adding adjacent only works if analysis is complete. // NOTE: We do not filter out adjacent functions here. @@ -123,7 +128,7 @@ pub fn build_function( }; if minimal { - return function; + return Some(function); } // Currently we only store the type if its a user type. @@ -142,7 +147,7 @@ pub fn build_function( .map(|c| bn_comment_to_comment(func, c)) .collect(); function.variables = build_variables(func); - function + Some(function) } /// Basic blocks sorted from high to low. -- cgit v1.3.1