Skip to content

Commit e09a04d

Browse files
committed
[WARP] Fix user annotations being overriden by WARP annotations
Fixes #7194
1 parent 0152aee commit e09a04d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

plugins/warp/src/plugin/workflow.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,12 @@ pub fn insert_workflow() {
197197
&matched_function.symbol,
198198
function.symbol().address(),
199199
));
200-
if let Some(func_ty) = &matched_function.ty {
201-
function.set_auto_type(&to_bn_type(&function.arch(), func_ty));
200+
// core.function.propagateAnalysis will assign user type info to auto, so we must not apply
201+
// otherwise we will wipe over user type info.
202+
if !function.has_user_type() {
203+
if let Some(func_ty) = &matched_function.ty {
204+
function.set_auto_type(&to_bn_type(&function.arch(), func_ty));
205+
}
202206
}
203207
// TODO: How to clear the comments? They are just persisted.
204208
// TODO: Also they generate an undo action, i hate implicit undo actions so much.
@@ -218,6 +222,11 @@ pub fn insert_workflow() {
218222
decl_instr.variable_for_stack_location_after(offset)
219223
}
220224
};
225+
if mlil.is_var_user_defined(&decl_var) {
226+
// Internally, analysis will just assign user vars to auto vars and consult only that.
227+
// So we must skip if there is a user-defined var at the decl.
228+
continue;
229+
}
221230
let decl_ty = match variable.ty {
222231
Some(decl_ty) => to_bn_type(&function.arch(), &decl_ty),
223232
None => {

0 commit comments

Comments
 (0)