Repository navigation
Determinism and hardening improvements - #101
Merged
Merged
Conversation
Replaced by the "Harden DexBackedDexFile against malformed DEX" commit. This reverts commit 491ae88.
Ensure callSiteComparator tie-breaks deterministically on call site name when encoded array offsets match, and align CallSiteReference equality. Standardize data section sorting to lexicographical order across writeEncodedArrays and CollectionUtils.compareAsSet, resolving a bug in compareAsSet where pre-sorting size comparisons could crash or error. Additionally, replace ArraySortedSet.of with copyOf in CollectionUtils and PoolClassDef to ensure collections are genuinely sorted when wrapped. Flag: EXEMPT BUGFIX Test: repeated builds produce the same file/hash now Change-Id: I85d39888f69a5e4aff90e273e9d6f4092f676215 TAG=agy CONV=396b0ad6-b46c-4693-90c5-77ac4f18be23
Resolve pre-existing bugs in ArraySortedSet where isEmpty() returned true for non-empty sets and toArray(T[] a) had inverted array boundary checks. Add unit tests for both methods in ArraySortedSetTest. Flag: EXEMPT BUGFIX Test: ./gradlew :dexlib2:test --tests com.android.tools.smali.util.ArraySortedSetTest TAG=agy CONV=92fcec37-cdaa-44ee-9f03-128bec8492e3 Change-Id: I1c375e8bddbb1373081b2688b18593f18a601ee5
Introduce ZipDexEntry interface extending DexEntry to expose the uncompressed ZIP entry CRC-32 checksum via getCrc(). Update ZipDexContainer to instantiate ZipDexEntry objects when reading ZIP archives, allowing callers to inspect entry checksums. Add unit test coverage in ZipDexContainerTest. Flag: EXEMPT PURE_REFACTOR Test: ./gradlew :dexlib2:test --tests com.android.tools.smali.dexlib2.dexbacked.ZipDexContainerTest TAG=agy CONV=92fcec37-cdaa-44ee-9f03-128bec8492e3 Change-Id: If4205d80fccafa4e80be7684ec81b3a6e46c173e
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Update smaliTreeWalker grammar definition to access totalMethodRegisters and methodParameterRegisters via ANTLR $method dynamic attribute scoping rather than referencing the generated internal method_stack stack structure directly. Change-Id: I8bceb392e69e0b71700c0da195964efacfe6680d
Update ZipDexContainer.getEntries() to store entries in insertion order via LinkedHashMap. Scan ZIP archives to load classes.dex, classes2.dex, etc. sequentially until classesN.dex is missing, then load remaining DEX files in lexicographically sorted order. When loading virtual DEX entries from container DEX files, check whether the entry is both isDexContainerFirstEntry and isDexContainerLastEntry; if so, omit the entry suffix (/0, /1, etc.), otherwise append the suffix. Load DEX entries only up to the container range and ignore any trailing garbage, aligning with ART's loader behavior. Add unit test coverage in ZipDexContainerTest. Flag: EXEMPT PURE_REFACTOR Test: ./gradlew :dexlib2:test --tests com.android.tools.smali.dexlib2.dexbacked.ZipDexContainerTest TAG=agy CONV=de2c422c-7039-42f4-a565-4aeb48b07bc7 Change-Id: I5550a749deda3dc283744dc46924177a2a63f0c4
Harden DexBackedDexFile against malformed and corrupted DEX files to prevent unchecked runtime crashes (such as OutOfBounds exceptions). Ensure buffer capacity checks guard magic parsing and version checking. Align constructor validation to enforce minimum header sizes and bounds checking relative to header_offset. Uphold specification constraints on container DEX files (v41+) and lazy load map items on demand. Test: ./gradlew :dexlib2:test Flag: EXEMPT BUGFIX TAG=agy CONV=af5f83f4-d40c-419f-9452-99168f7eb18f Change-Id: I15a7c9226aa61ec44d086c2e5daa6cf34b9f0987
sgjesse
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.