Skip to content

Commit

Permalink
Dirty hack when decoding strings
Browse files Browse the repository at this point in the history
  • Loading branch information
lukhio committed May 20, 2024
1 parent be8f797 commit f2cc84b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/dex_strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,24 @@ impl DexStrings {
dex_reader.bytes.read_until(0, &mut raw_string).unwrap();
raw_string.pop();

// TODO: `mutf8::decode()` has some issues which leads to
// string ordering issues. For now we use `String::from_utf8_lossy()`
// which works as long as the app doesn't actually use UTF-16
let decoded = String::from_utf8_lossy(&raw_string).to_string();
/*
let (decoded, is_raw) = match mutf8::decode(&raw_string) {
Ok(decoded) => (decoded, false),
Err(_) => {
error!("invalid MUTF-8 string");
(String::from(""), true)
}
};
*/

strings.push(DexStringsItem {
utf16_size,
offset: string_offset,
is_raw,
is_raw: true,
string: decoded,
});
} else {
Expand Down

0 comments on commit f2cc84b

Please sign in to comment.