Repository navigation
fix: 修复 PVM2 const-wide/32 负立即数符号扩展 - #79
Merged
Merged
Conversation
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.
根因
PVM2 Packer 在编译 Dalvik
const-wide/32(opcode0x17)时,把 32 位立即数当成无符号数扩展:-2147483648(Integer.MIN_VALUE)被写成+2147483648。这类常量用于
Pvm2的Integer/Long边界判断时,会把合法的1判成越界并返回null。真实表现:服务端返回
{"code":1},但 PVM2 转换后的Integer归一化方法返回null,App 业务层只能看到code=null。修复
Pvm2Compiler.java的0x17改为按有符号int读取,再扩展到longtools/xop-pvm2-packer.jarconst-wide/32 -2147483648经 PVM2 编译后必须返回-2147483648验证
make test-pvm2PVM2_SANITIZER='' make test-pvm2-runtimeD(Integer 1)修复前null,修复后1D(Long 1)、D(Double 1)、D(Float 1)同样恢复D(String "1")仍为1影响
这是加固工具自身的 PVM2 编译器修复。已加固的 APK/AAB 需要用修复后的 Shellsmith 重新加固才会生效;服务端和 App 业务代码无需修改。