fix: resolve #1212 — 360加固之后,一些代码会导致崩溃,另外isProtectedApp=true的情况#1801
Open
Nam0101 wants to merge 3 commits into
Open
fix: resolve #1212 — 360加固之后,一些代码会导致崩溃,另外isProtectedApp=true的情况#1801Nam0101 wants to merge 3 commits into
Nam0101 wants to merge 3 commits into
Conversation
Fixes Tencent#1212 Signed-off-by: Nguyen Van Nam <nam.nv205106@gmail.com>
Fixes Tencent#1212 Signed-off-by: Nguyen Van Nam <nam.nv205106@gmail.com>
Fixes Tencent#1212 Signed-off-by: Nguyen Van Nam <nam.nv205106@gmail.com>
Member
|
|
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.
Summary
fix: resolve #1212 — 360加固之后,一些代码会导致崩溃,另外isProtectedApp=true的情况
Problem
Severity:
High| File:tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/dexpatcher/DexPatchGenerator.javaThe IllegalAccessError reported (
'FindFragment' attempting to access 'FindFragment$4') is caused by the outer class living inchanged_classes2.dex.jar(loaded by Tinker's patch ClassLoader) while the inner classFindFragment$4remains in the hardened base dex (loaded by a different ClassLoader installed by 360 Jiagu). Even though the inner class wasn't textually modified, it must travel with its outer class so that both classes resolve via the same ClassLoader at runtime; otherwise ART enforces package-private/inner-class access checks across ClassLoaders and rejects the access.Solution
After the diff phase produces the set of "changed" classes, walk that set and for each class name
Lcom/foo/Outer;find every class in the new dex whose name matchesLcom/foo/Outer$.*;(and recursively for nested inner classes). Add those classes to the patch output even if the diff considered them unchanged. Concretely:Changes
tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/dexpatcher/DexPatchGenerator.java(modified)tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/patch/Configuration.java(modified)tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/dexpatcher/util/RelatedClassResolver.java(new)Testing
Note: this change was drafted with AI assistance and reviewed locally before submission.