Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug包正常,release包static String的变量初始值丢失问题 #141

Open
Bewitching-coder opened this issue Sep 12, 2023 · 4 comments
Labels

Comments

@Bewitching-coder
Copy link

release包在visitField方法中object值不为空,在返回时变量被置空,在接下来的visitLdcInsn和visitFieldInsn方法中不会执行这个变量的回调,编译出包后变量初始为空

@MegatronKing
Copy link
Owner

使用的Java版本是多少?

@Bewitching-coder
Copy link
Author

jdk 11

@Bewitching-coder
Copy link
Author

静态变量当有初始值时,stringfog会在StringFogClassVisitor的visitField中置空,在的visitCode中不会去对mStaticFields中的存储的value不为空的变量赋值,在接下来的visitLdcInsn和visitFieldInsn方法中不会对变量赋值,导致编译出的apk中的静态变量初始值为空

@Bewitching-coder
Copy link
Author

目前打印了项目中所以的静态变量,发现有3处出现这个问题,腾讯的OpenSDK中有2处,我的解决方案是在clinit的visitCode中对mStaticFields中的存储的value不为空的变量加密赋值

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants