Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Quincy379
jadx
提交
7f4e6418
J
jadx
项目概览
Quincy379
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7f4e6418
编写于
2月 15, 2019
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: skip duplicated block in complex if (#441)
上级
710245d5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
687 addition
and
1 deletion
+687
-1
jadx-core/src/main/java/jadx/core/dex/visitors/regions/IfMakerHelper.java
...in/java/jadx/core/dex/visitors/regions/IfMakerHelper.java
+12
-1
jadx-core/src/test/java/jadx/tests/integration/conditions/TestComplexIf.java
...java/jadx/tests/integration/conditions/TestComplexIf.java
+39
-0
jadx-core/src/test/smali/conditions/TestComplexIf.smali
jadx-core/src/test/smali/conditions/TestComplexIf.smali
+636
-0
未找到文件。
jadx-core/src/main/java/jadx/core/dex/visitors/regions/IfMakerHelper.java
浏览文件 @
7f4e6418
...
...
@@ -263,7 +263,18 @@ public class IfMakerHelper {
result
.
setIfBlock
(
first
.
getIfBlock
());
result
.
merge
(
first
,
second
);
BlockNode
otherPathBlock
=
followThenBranch
?
first
.
getElseBlock
()
:
first
.
getThenBlock
();
BlockNode
otherPathBlock
;
if
(
followThenBranch
)
{
otherPathBlock
=
first
.
getElseBlock
();
if
(!
otherPathBlock
.
equals
(
result
.
getElseBlock
()))
{
result
.
getSkipBlocks
().
add
(
otherPathBlock
);
}
}
else
{
otherPathBlock
=
first
.
getThenBlock
();
if
(!
otherPathBlock
.
equals
(
result
.
getThenBlock
()))
{
result
.
getSkipBlocks
().
add
(
otherPathBlock
);
}
}
skipSimplePath
(
otherPathBlock
,
result
.
getSkipBlocks
());
return
result
;
}
...
...
jadx-core/src/test/java/jadx/tests/integration/conditions/TestComplexIf.java
0 → 100644
浏览文件 @
7f4e6418
package
jadx.tests.integration.conditions
;
import
org.junit.Test
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.SmaliTest
;
import
static
jadx
.
tests
.
api
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
junit
.
Assert
.
assertThat
;
public
class
TestComplexIf
extends
SmaliTest
{
/*
public final class TestComplexIf {
private String a;
private int b;
private float c;
public final boolean test() {
if (this.a.equals("GT-P6200") || this.a.equals("GT-P6210") || ... ) {
return true;
}
if (this.a.equals("SM-T810") || this.a.equals("SM-T813") || ...) {
return false;
}
return this.c > 160.0f ? true : this.c <= 0.0f && ((this.b & 15) == 4 ? 1 : null) != null;
}
}
*/
@Test
public
void
test
()
{
ClassNode
cls
=
getClassNodeFromSmaliWithPkg
(
"conditions"
,
"TestComplexIf"
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsOne
(
"if (this.a.equals(\"GT-P6200\") || this.a.equals(\"GT-P6210\") || this.a.equals(\"A100\") "
+
"|| this.a.equals(\"A101\") || this.a.equals(\"LIFETAB_S786X\") || this.a.equals(\"VS890 4G\")) {"
));
}
}
jadx-core/src/test/smali/conditions/TestComplexIf.smali
0 → 100644
浏览文件 @
7f4e6418
.class public final Lconditions/TestComplexIf;
.super Ljava/lang/Object;
# instance fields
.field private a:Ljava/lang/String;
.field private b:I
.field private c:F
# direct methods
.method public constructor <init>()V
.locals 1
return-void
.end method
.method public final test()Z
.locals 5
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v1, "GT-P6200"
invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
const/4 v1, 0x1
if-nez v0, :cond_b
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v2, "GT-P6210"
invoke-virtual {v0, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_b
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v2, "A100"
invoke-virtual {v0, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_b
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v2, "A101"
invoke-virtual {v0, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_b
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v2, "LIFETAB_S786X"
invoke-virtual {v0, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_0
goto/16 :goto_2
:cond_0
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v2, "VS890 4G"
invoke-virtual {v0, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_1
return v1
:cond_1
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v2, "SM-T810"
invoke-virtual {v0, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
const/4 v2, 0x0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T813"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T815"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T815N0"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T815Y"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T820"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T825"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-P585"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-P585N0"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T561"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T567V"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T320"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T321"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T325"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T700"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T705"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T705M"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T705Y"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SC-03G"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "GT-N5100"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "GT-N5105"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "GT-N5110"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "GT-N5120"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SHW-M500W"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T310"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T311"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T315"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T330"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T330NU"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T331"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T335"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T337V"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T710"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T715"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T715N0"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SM-T719"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "GT-P6800"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "SC-01E"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_2
goto/16 :goto_1
:cond_2
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "LG-V500"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "LG-V930"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_3
goto/16 :goto_1
:cond_3
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "P01T_1"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "P01MA"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "Nexus 9"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "ASUS_P00I"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_4
goto :goto_1
:cond_4
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "Lenovo YT3-X90X"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_a
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "Lenovo YT-X703F"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_5
goto :goto_1
:cond_5
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "PMT3408_4G"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_6
return v2
:cond_6
iget-object v0, p0, Lconditions/TestComplexIf;->a:Ljava/lang/String;
const-string v3, "MediaPad T2 10.0 Pro"
invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_7
return v2
:cond_7
iget-object v0, p0, Lconditions/TestComplexIf;->b:I
and-int/lit8 v0, v0, 0xf
const/4 v3, 0x4
if-ne v0, v3, :cond_8
const/4 v0, 0x1
goto :goto_0
:cond_8
const/4 v0, 0x0
:goto_0
iget v3, p0, Lconditions/TestComplexIf;->c:F
const/high16 v4, 0x43200000 # 160.0f
cmpl-float v3, v3, v4
if-lez v3, :cond_9
return v1
:cond_9
iget v3, p0, Lconditions/TestComplexIf;->c:F
const/4 v4, 0x0
cmpg-float v3, v3, v4
if-gtz v3, :cond_a
if-eqz v0, :cond_a
return v1
:cond_a
:goto_1
return v2
:cond_b
:goto_2
return v1
.end method
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录