From 60c2332712f33e44d85b9073f0d062b537bb7178 Mon Sep 17 00:00:00 2001 From: Enkelmann <46347022+Enkelmann@users.noreply.github.com> Date: Fri, 10 Jun 2022 13:19:08 +0200 Subject: [PATCH] Ensure that generic output IDs are pointer sized in FnSig analysis (#334) --- .../src/analysis/function_signature/state/call_handling.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cwe_checker_lib/src/analysis/function_signature/state/call_handling.rs b/src/cwe_checker_lib/src/analysis/function_signature/state/call_handling.rs index 59695cab5..525896d99 100644 --- a/src/cwe_checker_lib/src/analysis/function_signature/state/call_handling.rs +++ b/src/cwe_checker_lib/src/analysis/function_signature/state/call_handling.rs @@ -85,7 +85,7 @@ impl State { self.register.retain(|var, _| callee_saved.contains(var)); } - /// Fill every return register that might be a pointer with a value that may point to any input ID + /// Fill every return register that might be a pointer with a value that may point to any pointer-sized input ID /// or to an output ID specific to the call and output register. fn generate_return_values_for_call( &mut self, @@ -93,12 +93,13 @@ impl State { return_args: &[Arg], call_tid: &Tid, ) { - // Fill every output register with a value that may point to any input ID + // Fill every output register with a value that may point to any pointer-sized input ID // or to an output ID specific to the call and output register. let generic_pointer_size = self.stack_id.unwrap_register().size; let generic_output_relative_values: BTreeMap = input_ids .iter() + .filter(|id| id.bytesize() == generic_pointer_size) .map(|id| (id.clone(), BitvectorDomain::new_top(generic_pointer_size))) .collect(); let mut generic_output = DataDomain::new_top(generic_pointer_size);