continue parsing the application instead of falling when encontering invalid code
This commit is contained in:
parent
0990b8a9b2
commit
0e2bb5fe2d
1 changed files with 14 additions and 6 deletions
|
|
@ -7,7 +7,7 @@ use std::fs::File;
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use log::info;
|
use log::{error, info};
|
||||||
#[cfg(feature = "python")]
|
#[cfg(feature = "python")]
|
||||||
use pyo3::{prelude::*, types::PyBytes};
|
use pyo3::{prelude::*, types::PyBytes};
|
||||||
|
|
||||||
|
|
@ -804,11 +804,19 @@ impl Apk {
|
||||||
let code = if code_off == 0 {
|
let code = if code_off == 0 {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(
|
match Self::get_code_from_off(code_off, dex, label_each_ins)
|
||||||
Self::get_code_from_off(code_off, dex, label_each_ins).with_context(|| {
|
.with_context(|| format!("Failed to parse code of method {}", descriptor.__str__()))
|
||||||
format!("Failed to parse code of method {}", descriptor.__str__())
|
{
|
||||||
})?,
|
Err(e) => {
|
||||||
)
|
error!(
|
||||||
|
"Code of {} could not be loaded: {}",
|
||||||
|
descriptor.__str__(),
|
||||||
|
e
|
||||||
|
);
|
||||||
|
None
|
||||||
|
}
|
||||||
|
Ok(code) => Some(code),
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Method {
|
Ok(Method {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue