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
e9591efd
Commit
e9591efd
authored
Dec 25, 2018
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: search exception handler splitter block by offset if jump source unknown (#406)
parent
fbf750f5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
BlockSplitter.java
...ava/jadx/core/dex/visitors/blocksmaker/BlockSplitter.java
+14
-3
No files found.
jadx-core/src/main/java/jadx/core/dex/visitors/blocksmaker/BlockSplitter.java
View file @
e9591efd
...
...
@@ -223,12 +223,13 @@ public class BlockSplitter extends AbstractVisitor {
BlockNode
thisBlock
=
getBlock
(
jump
.
getDest
(),
blocksMap
);
connect
(
srcBlock
,
thisBlock
);
}
connectExceptionHandlers
(
block
,
insn
);
connectExceptionHandlers
(
block
,
insn
,
blocksMap
);
}
}
}
private
static
void
connectExceptionHandlers
(
BlockNode
block
,
InsnNode
insn
)
{
private
static
void
connectExceptionHandlers
(
BlockNode
block
,
InsnNode
insn
,
Map
<
Integer
,
BlockNode
>
blocksMap
)
{
CatchAttr
catches
=
insn
.
get
(
AType
.
CATCH_BLOCK
);
SplitterBlockAttr
spl
=
block
.
get
(
AType
.
SPLITTER_BLOCK
);
if
(
catches
==
null
||
spl
==
null
)
{
...
...
@@ -237,7 +238,7 @@ public class BlockSplitter extends AbstractVisitor {
BlockNode
splitterBlock
=
spl
.
getBlock
();
boolean
tryEnd
=
insn
.
contains
(
AFlag
.
TRY_LEAVE
);
for
(
ExceptionHandler
h
:
catches
.
getTryBlock
().
getHandlers
())
{
BlockNode
handlerBlock
=
h
.
getHandlerBlock
(
);
BlockNode
handlerBlock
=
initHandlerBlock
(
h
,
blocksMap
);
// skip self loop in handler
if
(
splitterBlock
!=
handlerBlock
)
{
if
(!
handlerBlock
.
contains
(
AType
.
SPLITTER_BLOCK
))
{
...
...
@@ -251,6 +252,16 @@ public class BlockSplitter extends AbstractVisitor {
}
}
private
static
BlockNode
initHandlerBlock
(
ExceptionHandler
excHandler
,
Map
<
Integer
,
BlockNode
>
blocksMap
)
{
BlockNode
handlerBlock
=
excHandler
.
getHandlerBlock
();
if
(
handlerBlock
!=
null
)
{
return
handlerBlock
;
}
BlockNode
blockByOffset
=
getBlock
(
excHandler
.
getHandleOffset
(),
blocksMap
);
excHandler
.
setHandlerBlock
(
blockByOffset
);
return
blockByOffset
;
}
private
static
boolean
isSplitByJump
(
InsnNode
prevInsn
,
InsnNode
currentInsn
)
{
List
<
JumpInfo
>
pJumps
=
prevInsn
.
getAll
(
AType
.
JUMP
);
for
(
JumpInfo
jump
:
pJumps
)
{
...
...
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