Skip to content

dev-0.1.2-post4

Latest

Choose a tag to compare

@MG1937 MG1937 released this 30 Oct 03:26
7f25520

v0.1.2-post4

Fixed

  • findrefs returned wrong or missing matches on DEX files whose string data is not written in string_ids order.
    StringLocator assumed 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 getDeviceId query reporting Display.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_off and resolves each match with a binary search over the physical offsets, returning the index of the item that actually holds the match. This matches the rust_ASC implementation and makes no assumption about item order.

  • getclass slowdown 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 findrefs output equality across layouts.
  • Full suite: 146 tests pass.

Upgrade

No API changes. droidasc is on PyPI; pip install -U droidasc.