Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
极致猎手
jadx
提交
97e8a349
J
jadx
项目概览
极致猎手
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
97e8a349
编写于
2月 15, 2022
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: prevent some NPE in try/catch/finally processing (#1379)
上级
82f3b57e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
23 addition
and
2 deletion
+23
-2
jadx-core/src/main/java/jadx/core/dex/visitors/finaly/MarkFinallyVisitor.java
...ava/jadx/core/dex/visitors/finaly/MarkFinallyVisitor.java
+5
-1
jadx-core/src/main/java/jadx/core/utils/BlockUtils.java
jadx-core/src/main/java/jadx/core/utils/BlockUtils.java
+18
-1
未找到文件。
jadx-core/src/main/java/jadx/core/dex/visitors/finaly/MarkFinallyVisitor.java
浏览文件 @
97e8a349
...
...
@@ -154,7 +154,11 @@ public class MarkFinallyVisitor extends AbstractVisitor {
// remove 'finally' from 'try' blocks, check all up paths on each exit (connected with finally exit)
List
<
BlockNode
>
tryBlocks
=
allHandler
.
getTryBlock
().
getBlocks
();
BlockNode
bottomFinallyBlock
=
BlockUtils
.
followEmptyPath
(
BlockUtils
.
getBottomBlock
(
allHandler
.
getBlocks
()));
BlockNode
bottomBlock
=
BlockUtils
.
getBottomBlock
(
allHandler
.
getBlocks
());
if
(
bottomBlock
==
null
)
{
return
false
;
}
BlockNode
bottomFinallyBlock
=
BlockUtils
.
followEmptyPath
(
bottomBlock
);
BlockNode
bottom
=
BlockUtils
.
getNextBlock
(
bottomFinallyBlock
);
if
(
bottom
==
null
)
{
return
false
;
...
...
jadx-core/src/main/java/jadx/core/utils/BlockUtils.java
浏览文件 @
97e8a349
...
...
@@ -35,6 +35,7 @@ import jadx.core.dex.nodes.IBlock;
import
jadx.core.dex.nodes.InsnNode
;
import
jadx.core.dex.nodes.MethodNode
;
import
jadx.core.dex.regions.conditions.IfCondition
;
import
jadx.core.dex.trycatch.ExceptionHandler
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
public
class
BlockUtils
{
...
...
@@ -382,6 +383,7 @@ public class BlockUtils {
/**
* Return first successor which not exception handler and not follow loop back edge
*/
@Nullable
public
static
BlockNode
getNextBlock
(
BlockNode
block
)
{
List
<
BlockNode
>
s
=
block
.
getCleanSuccessors
();
return
s
.
isEmpty
()
?
null
:
s
.
get
(
0
);
...
...
@@ -594,6 +596,7 @@ public class BlockUtils {
/**
* Search last block in control flow graph from input set.
*/
@Nullable
public
static
BlockNode
getBottomBlock
(
List
<
BlockNode
>
blocks
)
{
if
(
blocks
.
size
()
==
1
)
{
return
blocks
.
get
(
0
);
...
...
@@ -701,7 +704,7 @@ public class BlockUtils {
mth
.
getLoops
().
forEach
(
l
->
excluded
.
set
(
l
.
getStart
().
getId
()));
if
(!
mth
.
isNoExceptionHandlers
())
{
// exclude exception handlers paths
mth
.
getExceptionHandlers
().
forEach
(
h
->
excluded
.
or
(
h
.
getHandlerBlock
().
getDomFrontier
()
));
mth
.
getExceptionHandlers
().
forEach
(
h
->
mergeExcHandlerDomFrontier
(
mth
,
h
,
excluded
));
}
domFrontBS
.
andNot
(
excluded
);
oneBlock
=
bitSetToOneBlock
(
mth
,
domFrontBS
);
...
...
@@ -738,6 +741,20 @@ public class BlockUtils {
}
}
private
static
void
mergeExcHandlerDomFrontier
(
MethodNode
mth
,
ExceptionHandler
handler
,
BitSet
set
)
{
BlockNode
handlerBlock
=
handler
.
getHandlerBlock
();
if
(
handlerBlock
==
null
)
{
mth
.
addDebugComment
(
"Null handler block in: "
+
handler
);
return
;
}
BitSet
domFrontier
=
handlerBlock
.
getDomFrontier
();
if
(
domFrontier
==
null
)
{
mth
.
addDebugComment
(
"Null dom frontier in handler: "
+
handler
);
return
;
}
set
.
or
(
domFrontier
);
}
public
static
BlockNode
getPathCross
(
MethodNode
mth
,
BlockNode
b1
,
BlockNode
b2
)
{
if
(
b1
==
b2
)
{
return
b1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录