Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions droidasc/asc_client/apk_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,20 @@ def _open_apk(self):
return fp, mm

def get_class_dex(self, dalvik_class : str):
# string_data_item is MUTF-8, not UTF-8: a code point above the BMP is
# stored as a surrogate pair (CESU-8), so a UTF-8-encoded query can never
# byte-match it and such a class was unreachable. MUTF-8 also keeps byte
# order aligned with the table's UTF-16 code-unit order, which the binary
# search in _find_type_idx relies on.
#
# The two encodings differ only above the BMP (and for an embedded NUL,
# which a descriptor cannot hold), so only such a name pays for the
# encoder - a compiled extension costing ~19ms to import, which every
# ordinary lookup would otherwise drag in on this path.
target_bytes = dalvik_class.encode("utf-8")
if any(ord(ch) > 0xFFFF for ch in dalvik_class):
from mutf8 import encode_modified_utf8
target_bytes = encode_modified_utf8(dalvik_class)
t_start = time.perf_counter()
fp, mm = self._open_apk()
try:
Expand Down
Loading