This commit is contained in:
Jean-Marie Mineau 2025-01-15 16:20:53 +01:00
parent b9f52e4ca5
commit dfcd6232a4
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2
4 changed files with 683 additions and 666 deletions

View file

@ -1,4 +1,6 @@
{ {
"dex_files": {
"classes.dex": {
"classes": { "classes": {
"Lcom/example/testclassloader/TestA;": { "Lcom/example/testclassloader/TestA;": {
"descriptor": "Lcom/example/testclassloader/TestA;", "descriptor": "Lcom/example/testclassloader/TestA;",
@ -78,7 +80,7 @@
} }
}, },
{ {
"ReturnVoid": null "ReturnVoid": {}
} }
] ]
} }
@ -142,7 +144,7 @@
} }
}, },
{ {
"ReturnVoid": null "ReturnVoid": {}
}, },
{ {
"Label": { "Label": {
@ -150,7 +152,7 @@
} }
}, },
{ {
"Nop": null "Nop": {}
} }
] ]
} }
@ -213,7 +215,7 @@
} }
}, },
{ {
"Nop": null "Nop": {}
} }
] ]
} }
@ -332,7 +334,7 @@
} }
}, },
{ {
"Nop": null "Nop": {}
} }
] ]
} }
@ -405,7 +407,7 @@
} }
}, },
{ {
"ReturnVoid": null "ReturnVoid": {}
} }
] ]
} }
@ -469,7 +471,7 @@
} }
}, },
{ {
"ReturnVoid": null "ReturnVoid": {}
}, },
{ {
"Label": { "Label": {
@ -477,7 +479,7 @@
} }
}, },
{ {
"Nop": null "Nop": {}
} }
] ]
} }
@ -598,7 +600,7 @@
} }
}, },
{ {
"Nop": null "Nop": {}
} }
] ]
} }
@ -659,7 +661,7 @@
} }
}, },
{ {
"Nop": null "Nop": {}
} }
] ]
} }
@ -669,4 +671,6 @@
} }
}, },
"not_referenced_strings": [] "not_referenced_strings": []
}
}
} }

View file

@ -551,7 +551,7 @@ fn test_2_from_json() {
let mut json = String::new(); let mut json = String::new();
file.read_to_string(&mut json).unwrap(); file.read_to_string(&mut json).unwrap();
let apk: Apk = serde_json::from_str(&json).unwrap(); let apk: Apk = serde_json::from_str(&json).unwrap();
let dex = apk.gen_raw_dex().unwrap().remove("classe.dex").unwrap(); let dex = apk.gen_raw_dex().unwrap().remove("classes.dex").unwrap();
let mut new_apk = Apk::new(); let mut new_apk = Apk::new();
new_apk new_apk
.add_dex_file("classes.dex", &dex, false, false) .add_dex_file("classes.dex", &dex, false, false)

View file

@ -63,7 +63,7 @@
} }
}, },
{ {
"ReturnVoid": null "ReturnVoid": {}
} }
] ]
} }
@ -184,7 +184,7 @@
} }
}, },
{ {
"Nop": null "Nop": {}
} }
] ]
} }

View file

@ -297,6 +297,15 @@ impl DebugInfoReader {
DbgBytecode::EndLocal { DbgBytecode::EndLocal {
register_num: Uleb128(register_num), register_num: Uleb128(register_num),
} => { } => {
// Yes this can happen
while self.register_states.len() < (register_num + 1) as usize {
self.register_states.push(DebugRegState {
name_idx: None,
type_idx: None,
sig_idx: None,
in_scope: false,
})
}
self.register_states[register_num as usize].in_scope = false; self.register_states[register_num as usize].in_scope = false;
Some(DebugInfo::EndLocal { Some(DebugInfo::EndLocal {
addr: self.address, addr: self.address,
@ -655,6 +664,10 @@ mod test {
addr_diff: Uleb128(51), addr_diff: Uleb128(51),
}, },
SpecialOpcode(14), SpecialOpcode(14),
// End a local that do not already exist
EndLocal {
register_num: Uleb128(41),
},
], ],
}; };
assert_eq!( assert_eq!(