Skip to content

Commit 20e877c

Browse files
authored
Some ProDG improvements (#101)
1 parent 88d0e6b commit 20e877c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/util/split.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,25 @@ fn split_ctors_dtors(obj: &mut ObjInfo, start: SectionAddress, end: SectionAddre
2626
let mut current_address = start;
2727
let mut referenced_symbols = vec![];
2828

29+
// ProDG ctor list can start with -1
30+
if matches!(read_u32(ctors_section, current_address.address), Some(0xFFFFFFFF)) {
31+
current_address += 4;
32+
}
33+
2934
while current_address < end {
35+
// ProDG hack when the end address is not known
36+
if matches!(read_u32(ctors_section, current_address.address), Some(0)) {
37+
while current_address < end {
38+
ensure!(
39+
matches!(read_u32(ctors_section, current_address.address), Some(0)),
40+
"{} data detected at {:#010X} after null pointer",
41+
ctors_section.name,
42+
current_address,
43+
);
44+
current_address += 4;
45+
}
46+
break;
47+
}
3048
let function_addr = read_address(obj, ctors_section, current_address.address)?;
3149
log::debug!("Found {} entry: {:#010X}", ctors_section.name, function_addr);
3250

0 commit comments

Comments
 (0)