Meituan-Dianping / Robust

Robust is an Android HotFix solution with high compatibility and high stability. Robust can fix bugs immediately without a reboot.
Apache License 2.0
4.42k stars 807 forks source link

Bugfix: 修复SmaliTool在修改字段的时候replace函数限制不严导致某些情况下smali中的类名会被修改成错误的类名的bug #216

Closed limengyun2008 closed 6 years ago

limengyun2008 commented 6 years ago

最近在试用Robust的过程中发现一个bug,为避免泄密就不贴真实代码了,转换成以下的case:

先假设以下是mapping.txt 中的内容:

com.example.Test -> com.example.l: com.example.Test$Companion Companion -> b

com.example.Test$Companion -> com.example.l$a:

Test.Companion.xxx()这句话会生成 //sget-object v4, Lcom/example/Test;->Companion:Lcom/example/Test$Companion; 如果按照原有逻辑, 会导致先翻译字段变成 //sget-object v4, Lcom/example/Test;->b:Lcom/example/Test$b; 再翻译类名变成 //sget-object v4, Lcom/example/l;->b:Lcom/example/l$b; 而正确的结果显然是 //sget-object v4, Lcom/example/l;->b:Lcom/example/l$a;

Change-Id: Iccf4f5896eb72dd254ef05a12d74c6c07f074aa1

hedex commented 6 years ago

@limengyun2008 感谢