From 6426ad6deac9aff5283895bc9bf8f4651c763906 Mon Sep 17 00:00:00 2001 From: Jean-Marie 'Histausse' Mineau Date: Sat, 27 Jan 2024 01:11:32 +0100 Subject: [PATCH] fix debug_info_off linking --- androscalpel/src/dex_writer.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/androscalpel/src/dex_writer.rs b/androscalpel/src/dex_writer.rs index 822be15..2fa9509 100644 --- a/androscalpel/src/dex_writer.rs +++ b/androscalpel/src/dex_writer.rs @@ -401,6 +401,7 @@ impl DexWriter { let mut min_addr = 0; let mut max_addr = 0; let mut label_min_max_addrs: HashMap = HashMap::new(); + for ins in &code.insns { match ins { Instruction::Label(Label { name }) => { @@ -2429,7 +2430,7 @@ impl DexWriter { debug!("Link the debug_info_off entries in code_items"); for code in self.code_items.iter_mut() { if code.debug_info_off != 0 { - code.debug_info_off += self.section_manager.get_offset(Section::DebugInfoItem); + code.debug_info_off += self.section_manager.get_offset(Section::DebugInfoItem) - 1; } } }