diff options
| author | Mason Reed <mason@vector35.com> | 2025-07-28 15:13:07 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-07-28 20:33:56 -0400 |
| commit | 7fce71c4d2a8b0b3ee207fa18814b6315d68a00a (patch) | |
| tree | c6ab0c846159a55c04bde527250d7eb9200eb5d3 /plugins | |
| parent | 819c0cbedcc6c7f0f8aba628a7a2875b7181e3f7 (diff) | |
[WARP] Fix user annotations being overriden by WARP annotations
Fixes https://github.com/Vector35/binaryninja-api/issues/7194
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/warp/src/plugin/workflow.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/warp/src/plugin/workflow.rs b/plugins/warp/src/plugin/workflow.rs index 380bd3fc..56823de4 100644 --- a/plugins/warp/src/plugin/workflow.rs +++ b/plugins/warp/src/plugin/workflow.rs @@ -199,8 +199,12 @@ pub fn insert_workflow() { &matched_function.symbol, function.symbol().address(), )); - if let Some(func_ty) = &matched_function.ty { - function.set_auto_type(&to_bn_type(&function.arch(), func_ty)); + // core.function.propagateAnalysis will assign user type info to auto, so we must not apply + // otherwise we will wipe over user type info. + if !function.has_user_type() { + if let Some(func_ty) = &matched_function.ty { + function.set_auto_type(&to_bn_type(&function.arch(), func_ty)); + } } // TODO: How to clear the comments? They are just persisted. // TODO: Also they generate an undo action, i hate implicit undo actions so much. @@ -220,6 +224,11 @@ pub fn insert_workflow() { decl_instr.variable_for_stack_location_after(offset) } }; + if mlil.is_var_user_defined(&decl_var) { + // Internally, analysis will just assign user vars to auto vars and consult only that. + // So we must skip if there is a user-defined var at the decl. + continue; + } let decl_ty = match variable.ty { Some(decl_ty) => to_bn_type(&function.arch(), &decl_ty), None => { |
