From 20e877c9ecda267b75bbb64d619abea4ea6864e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Balatoni?= <40299962+dbalatoni13@users.noreply.github.com> Date: Mon, 2 Jun 2025 00:43:13 +0200 Subject: [PATCH] Some ProDG improvements (#101) --- src/util/split.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/util/split.rs b/src/util/split.rs index a831e9e..e3ea084 100644 --- a/src/util/split.rs +++ b/src/util/split.rs @@ -26,7 +26,25 @@ fn split_ctors_dtors(obj: &mut ObjInfo, start: SectionAddress, end: SectionAddre let mut current_address = start; let mut referenced_symbols = vec![]; + // ProDG ctor list can start with -1 + if matches!(read_u32(ctors_section, current_address.address), Some(0xFFFFFFFF)) { + current_address += 4; + } + while current_address < end { + // ProDG hack when the end address is not known + if matches!(read_u32(ctors_section, current_address.address), Some(0)) { + while current_address < end { + ensure!( + matches!(read_u32(ctors_section, current_address.address), Some(0)), + "{} data detected at {:#010X} after null pointer", + ctors_section.name, + current_address, + ); + current_address += 4; + } + break; + } let function_addr = read_address(obj, ctors_section, current_address.address)?; log::debug!("Found {} entry: {:#010X}", ctors_section.name, function_addr);