Skip to content

Commit 04e3f08

Browse files
committed
add extra verifiction for address base calculation
1 parent 811bca2 commit 04e3f08

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

plugins/idb_import/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,13 @@ fn parse_id0_section_info<K: IDAKind>(
291291
let bv_baseaddr = bv.start();
292292
// just addr this value to the address to translate from ida to bn
293293
// NOTE this delta could wrap here and while using translating
294-
let addr_delta = bv_baseaddr.wrapping_sub(idb_baseaddr);
294+
// TODO the base is somethimes zero, whats causes problems, for now I'll
295+
// just use the min address to try calculanting the delta
296+
let addr_delta = if idb_baseaddr == 0 {
297+
bv_baseaddr.wrapping_sub(ida_info.addresses.min_ea.into_raw().into_u64())
298+
} else {
299+
bv_baseaddr.wrapping_sub(idb_baseaddr)
300+
};
295301

296302
for (idb_addr, info) in get_info(id0, id1, id2, &ida_info)? {
297303
let addr = addr_delta.wrapping_add(idb_addr.into_raw().into_u64());

0 commit comments

Comments
 (0)