Skip to content

Commit 002cbea

Browse files
committed
[WARP] Fix user annotations being overriden by WARP annotations
Fixes #7194
1 parent 3169983 commit 002cbea

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
@@ -199,8 +199,12 @@ pub fn insert_workflow() {
199199
&matched_function.symbol,
200200
function.symbol().address(),
201201
));
202-
if let Some(func_ty) = &matched_function.ty {
203-
function.set_auto_type(&to_bn_type(&function.arch(), func_ty));
202+
// core.function.propagateAnalysis will assign user type info to auto, so we must not apply
203+
// otherwise we will wipe over user type info.
204+
if !function.has_user_type() {
205+
if let Some(func_ty) = &matched_function.ty {
206+
function.set_auto_type(&to_bn_type(&function.arch(), func_ty));
207+
}
204208
}
205209
// TODO: How to clear the comments? They are just persisted.
206210
// TODO: Also they generate an undo action, i hate implicit undo actions so much.
@@ -220,6 +224,11 @@ pub fn insert_workflow() {
220224
decl_instr.variable_for_stack_location_after(offset)
221225
}
222226
};
227+
if mlil.is_var_user_defined(&decl_var) {
228+
// Internally, analysis will just assign user vars to auto vars and consult only that.
229+
// So we must skip if there is a user-defined var at the decl.
230+
continue;
231+
}
223232
let decl_ty = match variable.ty {
224233
Some(decl_ty) => to_bn_type(&function.arch(), &decl_ty),
225234
None => {

0 commit comments

Comments
 (0)