Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_76393173
jadx
提交
272e0d37
J
jadx
项目概览
2301_76393173
/
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,发现更多精彩内容 >>
提交
272e0d37
编写于
11月 26, 2013
作者:
1
13.beta2
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
core: fix missing code after 'if' inside loop
上级
132b8d06
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
48 addition
and
7 deletion
+48
-7
jadx-core/src/main/java/jadx/core/dex/visitors/BlockMakerVisitor.java
...c/main/java/jadx/core/dex/visitors/BlockMakerVisitor.java
+0
-1
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMaker.java
...main/java/jadx/core/dex/visitors/regions/RegionMaker.java
+36
-6
jadx-core/src/test/java/jadx/tests/internal/TestLoopCondition.java
.../src/test/java/jadx/tests/internal/TestLoopCondition.java
+12
-0
未找到文件。
jadx-core/src/main/java/jadx/core/dex/visitors/BlockMakerVisitor.java
浏览文件 @
272e0d37
...
...
@@ -353,7 +353,6 @@ public class BlockMakerVisitor extends AbstractVisitor {
// splice return block if several predecessors presents
for
(
BlockNode
block
:
mth
.
getExitBlocks
())
{
if
(
block
.
getInstructions
().
size
()
==
1
&&
block
.
getInstructions
().
get
(
0
).
getArgsCount
()
>
0
&&
!
block
.
getInstructions
().
get
(
0
).
getAttributes
().
contains
(
AttributeType
.
CATCH_BLOCK
)
&&
!
block
.
getAttributes
().
contains
(
AttributeFlag
.
SYNTHETIC
))
{
List
<
BlockNode
>
preds
=
new
ArrayList
<
BlockNode
>(
block
.
getPredecessors
());
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMaker.java
浏览文件 @
272e0d37
...
...
@@ -265,10 +265,10 @@ public class RegionMaker {
&&
r
.
getInstructions
().
size
()
>
0
&&
r
.
getInstructions
().
get
(
0
).
getType
()
==
InsnType
.
RETURN
)
{
next
.
getAttributes
().
add
(
new
ForceReturnAttr
(
r
.
getInstructions
().
get
(
0
)));
}
else
{
}
/*/
else {
next.getAttributes().add(AttributeFlag.BREAK);
stack.addExit(r);
}
}
/**/
}
else
{
stack
.
addExit
(
next
);
}
...
...
@@ -492,8 +492,10 @@ public class RegionMaker {
IfCondition
nestedCondition
=
IfCondition
.
fromIfNode
(
nestedIfInsn
);
if
(
isPathExists
(
bElse
,
nestedIfBlock
))
{
// else branch
if
(
bThen
!=
nbThen
)
{
if
(
bThen
!=
nbElse
)
{
if
(
bThen
!=
nbThen
&&
!
isEqualReturns
(
bThen
,
nbThen
))
{
if
(
bThen
!=
nbElse
&&
!
isEqualReturns
(
bThen
,
nbElse
))
{
// not connected conditions
break
;
}
...
...
@@ -503,8 +505,10 @@ public class RegionMaker {
condition
=
IfCondition
.
merge
(
Mode
.
OR
,
condition
,
nestedCondition
);
}
else
{
// then branch
if
(
bElse
!=
nbElse
)
{
if
(
bElse
!=
nbThen
)
{
if
(
bElse
!=
nbElse
&&
!
isEqualReturns
(
bElse
,
nbElse
))
{
if
(
bElse
!=
nbThen
&&
!
isEqualReturns
(
bElse
,
nbThen
))
{
// not connected conditions
break
;
}
...
...
@@ -516,6 +520,8 @@ public class RegionMaker {
result
=
new
IfInfo
();
result
.
setCondition
(
condition
);
nestedIfBlock
.
getAttributes
().
add
(
AttributeFlag
.
SKIP
);
bThen
.
getAttributes
().
add
(
AttributeFlag
.
SKIP
);
if
(
merged
!=
null
)
{
merged
.
add
(
nestedIfBlock
);
}
...
...
@@ -683,4 +689,28 @@ public class RegionMaker {
handler
.
getHandlerRegion
().
getAttributes
().
add
(
excHandlerAttr
);
}
private
boolean
isEqualReturns
(
BlockNode
b1
,
BlockNode
b2
)
{
if
(
b1
==
b2
)
{
return
true
;
}
if
(
b1
==
null
||
b2
==
null
)
{
return
false
;
}
if
(
b1
.
getInstructions
().
size
()
+
b2
.
getInstructions
().
size
()
!=
2
)
{
return
false
;
}
if
(!
b1
.
getAttributes
().
contains
(
AttributeFlag
.
RETURN
)
||
!
b2
.
getAttributes
().
contains
(
AttributeFlag
.
RETURN
))
{
return
false
;
}
if
(
b1
.
getInstructions
().
get
(
0
).
getArgsCount
()
>
0
)
{
if
(
b1
.
getInstructions
().
get
(
0
).
getArg
(
0
)
!=
b2
.
getInstructions
().
get
(
0
).
getArg
(
0
))
{
return
false
;
}
}
return
true
;
}
}
jadx-core/src/test/java/jadx/tests/internal/TestLoopCondition.java
浏览文件 @
272e0d37
...
...
@@ -39,6 +39,16 @@ public class TestLoopCondition extends InternalJadxTest {
}
return
i
;
}
private
void
testMoreComplexIfInLoop
(
java
.
util
.
ArrayList
<
String
>
list
)
throws
Exception
{
for
(
int
i
=
0
;
i
!=
16
&&
i
<
255
;
i
++)
{
list
.
set
(
i
,
"ABC"
);
if
(
i
==
128
)
{
return
;
}
list
.
set
(
i
,
"DEF"
);
}
}
}
@Test
...
...
@@ -50,5 +60,7 @@ public class TestLoopCondition extends InternalJadxTest {
assertThat
(
code
,
containsString
(
"i < f.length()"
));
assertThat
(
code
,
containsString
(
"while (a && i < 10) {"
));
assertThat
(
code
,
containsString
(
"list.set(i, \"ABC\")"
));
assertThat
(
code
,
containsString
(
"list.set(i, \"DEF\")"
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录