Repository navigation
v0.1.2-post4
Fixed
-
findrefsreturned wrong or missing matches on DEX files whose string data is not written instring_idsorder.
StringLocatorassumed the string data items were laid out in index order and mapped a match through the offset of the following item, then subtracted one. The DEX format does not require that order, and layout passes such as dexlayout (used when repackaging system APKs) permute the items. As a result:- a reversed layout collapsed the search region to
start > end, so every string was missed; - a partial permutation returned neighbouring indexes, producing false hits such as a
getDeviceIdquery reportingDisplay.getDeviceProductInfo.
Method and field lookups that resolve names through the same locator were affected too, not only
findrefs string.The locator now takes the region from the smallest and largest
string_data_offand resolves each match with a binary search over the physical offsets, returning the index of the item that actually holds the match. This matches therust_ASCimplementation and makes no assumption about item order. - a reversed layout collapsed the search region to
-
getclassslowdown introduced by smali formatting. Method descriptor normalization moved out of the decompiler hot path and into the smali formatter only, removing repeated string rewriting on every invoke.
Performance
Measured against the previous baseline on the same workload:
| Metric | Change |
|---|---|
unit/string_locator |
-32.5% |
unit/type_locator |
-56.1% |
unit/field_locator |
-11.2% |
unit/method_locator |
-9.3% |
unit/field_locator_fuzzy_class_only |
-40.5% |
unit/field_locator_fuzzy_class_field |
-18.8% |
No gated metric regressed. The new lookup costs one bisect plus one dict hit per match; it needs no terminator scan, which matters on DEX files that embed multi-hundred-kilobyte string payloads (a backwards \x00 scan across such an item was measured ~5x slower on Windows, where memrchr is unavailable).
Tests
- Added coverage for the ordered layout, a full reversal, and a middle permutation, plus
findrefsoutput equality across layouts. - Full suite:
146tests pass.
Upgrade
No API changes. droidasc is on PyPI; pip install -U droidasc.