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
b657b0fb
Commit
b657b0fb
authored
Aug 12, 2014
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix 'if' processing in 'do/while' loop
parent
4935ae6d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
RegionMaker.java
...main/java/jadx/core/dex/visitors/regions/RegionMaker.java
+2
-0
TestLoopConditionInvoke.java
...va/jadx/tests/internal/loops/TestLoopConditionInvoke.java
+47
-0
No files found.
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMaker.java
View file @
b657b0fb
...
...
@@ -199,9 +199,11 @@ public class RegionMaker {
BlockNode
thenBlock
=
condInfo
.
getThenBlock
();
out
=
(
thenBlock
==
loopStart
?
condInfo
.
getElseBlock
()
:
thenBlock
);
loopStart
.
remove
(
AType
.
LOOP
);
loop
.
getEnd
().
add
(
AFlag
.
SKIP
);
stack
.
addExit
(
loop
.
getEnd
());
loopRegion
.
setBody
(
makeRegion
(
loopStart
,
stack
));
loopStart
.
addAttr
(
AType
.
LOOP
,
loop
);
loop
.
getEnd
().
remove
(
AFlag
.
SKIP
);
}
else
{
out
=
condInfo
.
getElseBlock
();
if
(
outerRegion
!=
null
...
...
jadx-core/src/test/java/jadx/tests/internal/loops/TestLoopConditionInvoke.java
0 → 100644
View file @
b657b0fb
package
jadx
.
tests
.
internal
.
loops
;
import
jadx.api.InternalJadxTest
;
import
jadx.core.dex.nodes.ClassNode
;
import
org.junit.Test
;
import
static
jadx
.
tests
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
junit
.
Assert
.
assertThat
;
public
class
TestLoopConditionInvoke
extends
InternalJadxTest
{
public
static
class
TestCls
{
private
static
final
char
STOP_CHAR
=
0
;
private
int
pos
;
private
boolean
test
(
char
lastChar
)
{
int
startPos
=
pos
;
char
ch
;
while
((
ch
=
next
())
!=
STOP_CHAR
)
{
if
(
ch
==
lastChar
)
{
return
true
;
}
}
pos
=
startPos
;
return
false
;
}
private
char
next
()
{
return
0
;
}
}
@Test
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
System
.
out
.
println
(
code
);
assertThat
(
code
,
containsOne
(
"do {"
));
assertThat
(
code
,
containsOne
(
"if (ch == '\\u0000') {"
));
assertThat
(
code
,
containsOne
(
"this.pos = startPos;"
));
assertThat
(
code
,
containsOne
(
"return false;"
));
assertThat
(
code
,
containsOne
(
"} while (ch != lastChar);"
));
assertThat
(
code
,
containsOne
(
"return true;"
));
}
}
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