Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ql04210214
jadx
提交
26aa5045
J
jadx
项目概览
ql04210214
/
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,发现更多精彩内容 >>
提交
26aa5045
编写于
6月 17, 2014
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
core: guard endless regions processing
上级
e4dde3f4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
4 deletion
+24
-4
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMaker.java
...main/java/jadx/core/dex/visitors/regions/RegionMaker.java
+9
-0
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionStack.java
...main/java/jadx/core/dex/visitors/regions/RegionStack.java
+5
-2
jadx-core/src/main/java/jadx/core/utils/ErrorsCounter.java
jadx-core/src/main/java/jadx/core/utils/ErrorsCounter.java
+3
-2
jadx-core/src/main/java/jadx/core/utils/exceptions/JadxOverflowException.java
...ava/jadx/core/utils/exceptions/JadxOverflowException.java
+7
-0
未找到文件。
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMaker.java
浏览文件 @
26aa5045
...
...
@@ -28,6 +28,7 @@ import jadx.core.utils.BlockUtils;
import
jadx.core.utils.ErrorsCounter
;
import
jadx.core.utils.InstructionRemover
;
import
jadx.core.utils.RegionUtils
;
import
jadx.core.utils.exceptions.JadxOverflowException
;
import
java.util.ArrayList
;
import
java.util.BitSet
;
...
...
@@ -49,8 +50,12 @@ import static jadx.core.utils.BlockUtils.selectOther;
public
class
RegionMaker
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
RegionMaker
.
class
);
// 'dumb' guard to prevent endless loop in regions processing
private
static
final
int
REGIONS_LIMIT
=
1000
*
1000
;
private
final
MethodNode
mth
;
private
BitSet
processedBlocks
;
private
int
regionsCount
;
public
RegionMaker
(
MethodNode
mth
)
{
this
.
mth
=
mth
;
...
...
@@ -68,6 +73,10 @@ public class RegionMaker {
processedBlocks
.
set
(
id
);
}
}
regionsCount
++;
if
(
regionsCount
>
REGIONS_LIMIT
)
{
throw
new
JadxOverflowException
(
"Regions count limit reached"
);
}
Region
r
=
new
Region
(
stack
.
peekRegion
());
BlockNode
next
=
startBlock
;
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionStack.java
浏览文件 @
26aa5045
...
...
@@ -3,6 +3,7 @@ package jadx.core.dex.visitors.regions;
import
jadx.core.dex.nodes.BlockNode
;
import
jadx.core.dex.nodes.IRegion
;
import
jadx.core.dex.nodes.MethodNode
;
import
jadx.core.utils.exceptions.JadxOverflowException
;
import
java.util.ArrayDeque
;
import
java.util.Collection
;
...
...
@@ -17,6 +18,8 @@ final class RegionStack {
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
RegionStack
.
class
);
private
static
final
boolean
DEBUG
=
false
;
private
static
final
int
REGIONS_STACK_LIMIT
=
1000
;
static
{
if
(
DEBUG
)
{
LOG
.
debug
(
"Debug enabled for {}"
,
RegionStack
.
class
);
...
...
@@ -58,8 +61,8 @@ final class RegionStack {
public
void
push
(
IRegion
region
)
{
stack
.
push
(
curState
);
if
(
stack
.
size
()
>
1000
)
{
throw
new
StackOverflowError
(
"Deep code hierarchy
"
);
if
(
stack
.
size
()
>
REGIONS_STACK_LIMIT
)
{
throw
new
JadxOverflowException
(
"Regions stack size limit reached
"
);
}
curState
=
curState
.
copy
();
curState
.
region
=
region
;
...
...
jadx-core/src/main/java/jadx/core/utils/ErrorsCounter.java
浏览文件 @
26aa5045
...
...
@@ -5,6 +5,7 @@ import jadx.core.dex.attributes.IAttributeNode;
import
jadx.core.dex.attributes.nodes.JadxErrorAttr
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.core.dex.nodes.MethodNode
;
import
jadx.core.utils.exceptions.JadxOverflowException
;
import
java.util.HashSet
;
import
java.util.Set
;
...
...
@@ -32,9 +33,9 @@ public class ErrorsCounter {
errorsCount
++;
if
(
e
!=
null
)
{
if
(
e
.
getClass
()
==
StackOverflowError
.
class
)
{
if
(
e
.
getClass
()
==
JadxOverflowException
.
class
)
{
// don't print full stack trace
e
=
new
StackOverflowError
(
e
.
getMessage
());
e
=
new
JadxOverflowException
(
e
.
getMessage
());
LOG
.
error
(
msg
);
}
else
{
LOG
.
error
(
msg
,
e
);
...
...
jadx-core/src/main/java/jadx/core/utils/exceptions/JadxOverflowException.java
0 → 100644
浏览文件 @
26aa5045
package
jadx.core.utils.exceptions
;
public
class
JadxOverflowException
extends
JadxRuntimeException
{
public
JadxOverflowException
(
String
message
)
{
super
(
message
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录