Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
45f5e0cb
Commit
45f5e0cb
authored
Jun 16, 2018
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: prevent endless loop in region construction (#267)
parent
7d983f28
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
18 deletions
+6
-18
RegionMaker.java
...main/java/jadx/core/dex/visitors/regions/RegionMaker.java
+5
-17
DebugUtils.java
jadx-core/src/main/java/jadx/core/utils/DebugUtils.java
+1
-1
No files found.
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMaker.java
View file @
45f5e0cb
...
...
@@ -44,6 +44,7 @@ import jadx.core.utils.ErrorsCounter;
import
jadx.core.utils.InstructionRemover
;
import
jadx.core.utils.RegionUtils
;
import
jadx.core.utils.exceptions.JadxOverflowException
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
import
static
jadx
.
core
.
dex
.
visitors
.
regions
.
IfMakerHelper
.
confirmMerge
;
import
static
jadx
.
core
.
dex
.
visitors
.
regions
.
IfMakerHelper
.
makeIfInfo
;
...
...
@@ -60,34 +61,21 @@ public class RegionMaker {
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
;
if
(
Consts
.
DEBUG
)
{
this
.
processedBlocks
=
new
BitSet
(
mth
.
getBasicBlocks
().
size
());
}
}
public
Region
makeRegion
(
BlockNode
startBlock
,
RegionStack
stack
)
{
if
(
Consts
.
DEBUG
)
{
int
id
=
startBlock
.
getId
();
if
(
processedBlocks
.
get
(
id
))
{
LOG
.
debug
(
" Block already processed: {}, mth: {}"
,
startBlock
,
mth
);
}
else
{
processedBlocks
.
set
(
id
);
}
}
regionsCount
++;
if
(
regionsCount
>
REGIONS_LIMIT
)
{
throw
new
JadxOverflowException
(
"Regions count limit reached"
);
}
Region
r
=
new
Region
(
stack
.
peekRegion
());
BlockNode
next
=
startBlock
;
while
(
next
!=
null
)
{
next
=
traverse
(
r
,
next
,
stack
);
regionsCount
++;
if
(
regionsCount
>
REGIONS_LIMIT
)
{
throw
new
JadxRuntimeException
(
"Regions count limit reached"
);
}
}
return
r
;
}
...
...
jadx-core/src/main/java/jadx/core/utils/DebugUtils.java
View file @
45f5e0cb
...
...
@@ -45,7 +45,7 @@ public class DebugUtils {
}
public
static
void
dump
(
MethodNode
mth
,
String
desc
)
{
File
out
=
new
File
(
"test-graph"
+
desc
+
"-tmp"
);
File
out
=
new
File
(
"test-graph
-
"
+
desc
+
"-tmp"
);
DotGraphVisitor
.
dump
().
save
(
out
,
mth
);
DotGraphVisitor
.
dumpRaw
().
save
(
out
,
mth
);
DotGraphVisitor
.
dumpRegions
().
save
(
out
,
mth
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment