Skip to content

Fix DexParser method initialization#478

Closed
wangwillian0 wants to merge 3 commits intoJingMatrix:masterfrom
wangwillian0:patch-1
Closed

Fix DexParser method initialization#478
wangwillian0 wants to merge 3 commits intoJingMatrix:masterfrom
wangwillian0:patch-1

Conversation

@wangwillian0
Copy link
Contributor

@wangwillian0 wangwillian0 commented Nov 22, 2025

These bugs make the DexParser to not fill all the methods correctly, introducing unwanted nulls.

JingMatrix and others added 3 commits November 12, 2025 17:13
This reverts partially commit c622d0f.

In my test device (Pixel 6, Android 16 qpr2, KernelSU), calling twice LSPosed daemon results a detection based on `mount_id` values. In `com.reveny.nativecheck` 7.6.1, it is named as `Detected Magic Mount`.
Of course, this namning is incorrect and misleading. Whatever, see JingMatrix/NeoZygisk#39 for details of this detection point.
@wangwillian0 wangwillian0 changed the title Fix DexParser methodIds initialization Fix DexParser method initialization Nov 23, 2025
@JingMatrix
Copy link
Owner

Please provide examplar apps to show that you are solving some issue.
Currently, I don't see that your code is correct.

@JingMatrix JingMatrix closed this Jan 9, 2026
@Dev4Mod
Copy link

Dev4Mod commented Jan 9, 2026

So far I’ve seen only a few projects that use the Modern API and also use DexParser directly for obfuscated code, but judging by the fix it’s making, it seems to be correct — after all, there really are initialization issues. To test it, the only way is by creating a POC.

One app I know that uses the Modern API is PlayStrong, but it has a problem with this LSPosed that causes issues with the service bridge. I haven’t investigated the issue deeply though. PlayStrong is closed-source and only works with the official LSPosed (a private version called IT).

@JingMatrix
Copy link
Owner

Nobody needs a closed source PlayStrong. My open-source project TEESimulator can help getting STRONG integrity.

From this block, I don't see why would @wangwillian0 remove / 3 operation in the for loop.

this.methodIds = new MethodId[methodIds.length / 3];
for (int i = 0; i < this.methodIds.length / 3; ++i) {
this.methodIds[i] = new LSPosedMethodId(i, methodIds[3 * i], methodIds[3 * i + 1], methodIds[3 * i + 2]);
}

It is surely introducing a bug.

@Dev4Mod
Copy link

Dev4Mod commented Jan 9, 2026

Alright, first: I mentioned PlayStrong only as an example of an app that uses the Modern API — I wasn’t saying it should be used. Sorry if it somehow sounded offensive toward open-source code.

Second, in this.methodIds = new MethodId[methodIds.length / 3]; we’re already dividing by 3 on that line, and then inside the loop we divide again with this.methodIds.length / 3. The confusion comes from the "this" — look closely at it. I was confused at first too.

@JingMatrix
Copy link
Owner

JingMatrix commented Jan 9, 2026

No worry, I wasn't being offended. My tone was a bit aggressive, sorry for causing the mis-understanding.

Oh, you were right, I missed the this part as well.
Thanks for the clarification. I will inspect this problem with more details.

@JingMatrix JingMatrix reopened this Jan 9, 2026
@wangwillian0
Copy link
Contributor Author

Hi @JingMatrix. It's basically what @Dev4Mod said.

The second bug is more pronounced, you can see that this.parameters[0] and this.parameters[1] are simply never iterated through at all.

@JingMatrix
Copy link
Owner

@wangwillian0 Thanks for reporting this bug. Given the low quality of the original Java class, I decide to refactor it into Kotlin.

Your fix for array length is correct, but the protoId is not correct. See my pull-request #509 for details.

@JingMatrix JingMatrix closed this Jan 19, 2026
@wangwillian0
Copy link
Contributor Author

Your fix for array length is correct, but the protoId is not correct. See my pull-request #509 for details.

The logic of the Kotlin code looks the same as this PR, so I don't think this code was wrong, but nice to have the Kotlin rewrite. Thanks for handling the issue!

@JingMatrix
Copy link
Owner

The logic of the Kotlin code looks the same as this PR

Ah, yeah, you were right, I overlooked it. Sorry for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants