Skip to content

Commit 72f593c

Browse files
committed
[WARP] Consult type library function objects when matched function has no explicit type
Helps with windows functions where we had previously defined the signature
1 parent f52693d commit 72f593c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

plugins/warp/src/plugin/workflow.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::cache::{
33
cached_function_guid, insert_cached_function_match, try_cached_function_guid,
44
try_cached_function_match,
55
};
6-
use crate::convert::{platform_to_target, to_bn_type};
6+
use crate::convert::{platform_to_target, to_bn_symbol_at_address, to_bn_type};
77
use crate::matcher::{Matcher, MatcherSettings};
88
use crate::plugin::settings::PluginSettings;
99
use crate::{get_warp_ignore_tag_type, get_warp_tag_type, relocatable_regions, IGNORE_TAG_NAME};
@@ -260,6 +260,13 @@ pub fn insert_workflow() -> Result<(), ()> {
260260
if !function.has_user_type() {
261261
if let Some(func_ty) = &matched_function.ty {
262262
function.set_auto_type(&to_bn_type(Some(function.arch()), func_ty));
263+
} else if !function.has_explicitly_defined_type() {
264+
// Attempt to retrieve the type information from the named platform functions.
265+
// NOTE: We check `has_explicitly_defined_type` because after applying imported type
266+
// information, that flag will be set, allowing us to avoid applying it again.
267+
let bn_symbol =
268+
to_bn_symbol_at_address(&view, &matched_function.symbol, function.start());
269+
function.apply_imported_types(&bn_symbol, None);
263270
}
264271
}
265272
if let Some(mlil) = ctx.mlil_function() {

0 commit comments

Comments
 (0)