This repository was archived by the owner on Jul 27, 2024. It is now read-only.
const_string_encryption: Fix problem where static constructor not correctly found#98
Merged
ClaudiuGeorgiu merged 1 commit intoClaudiuGeorgiu:masterfrom May 30, 2021
Conversation
…rectly found The current code expects that static constructors are declared as: .method static constructor <clinit>()V However, static constructors in smali files may contain the "public" keyword so the static constructor has the form: .method public static constructor <clinit>()V The current code doesn't find such constructors and inserts another static constructor to the code instead so there are 2 static constructors. Smali seems to use only the first declared constructor (with the string initializers) and ignores the second one with the original initialization code which leads to uninitialized static members. This patch simply relaxes the check of static constructors so there can be an arbitrary string (including empty string) between ".method" and "static".
Codecov Report
@@ Coverage Diff @@
## master #98 +/- ##
=======================================
Coverage 77.57% 77.57%
=======================================
Files 49 49
Lines 2453 2453
Branches 486 486
=======================================
Hits 1903 1903
Misses 422 422
Partials 128 128
Continue to review full report at Codecov.
|
Owner
|
Thanks @techee! |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The current code expects that static constructors are declared as:
.method static constructor ()V
However, static constructors in smali files may contain the "public" keyword
so the static constructor has the form:
.method public static constructor ()V
The current code doesn't find such constructors and inserts another
static constructor to the code instead so there are 2 static constructors.
Smali seems to use only the first declared constructor (with the string
initializers) and ignores the second one with the original initialization
code which leads to uninitialized static members.
This patch simply relaxes the check of static constructors so there
can be an arbitrary string (including empty string) between ".method"
and "static".