add test
This commit is contained in:
parent
d47494f8f6
commit
ef6a2196a7
6 changed files with 580 additions and 9 deletions
|
|
@ -50,7 +50,9 @@ impl<'a> DexFileReader<'a> {
|
|||
method_handles: vec![],
|
||||
map_list: MapList { list: vec![] },
|
||||
};
|
||||
tmp_file.map_list = tmp_file.get_struct_at_offset(tmp_file.header.map_off)?;
|
||||
if tmp_file.header.map_off != 0 {
|
||||
tmp_file.map_list = tmp_file.get_struct_at_offset(tmp_file.header.map_off)?;
|
||||
}
|
||||
tmp_file.string_ids = tmp_file.get_item_list::<StringIdItem>(
|
||||
tmp_file.header.string_ids_off,
|
||||
tmp_file.header.string_ids_size,
|
||||
|
|
@ -365,6 +367,9 @@ impl<'a> DexFileReader<'a> {
|
|||
}
|
||||
|
||||
fn get_item_list<T: Serializable>(&self, offset: u32, size: u32) -> Result<Vec<T>> {
|
||||
if offset == 0 {
|
||||
return Ok(vec![]);
|
||||
}
|
||||
let mut buffer = Cursor::new(self.data);
|
||||
buffer.seek(SeekFrom::Start(offset as u64)).map_err(|err| {
|
||||
Error::DeserializationError(format!("Failed to seek 0x{offset:x} position: {err}"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue