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
a9c0185b
Commit
a9c0185b
authored
Apr 18, 2015
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix type resolver in 'if'
parent
0111172a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
2 deletions
+56
-2
IfNode.java
...core/src/main/java/jadx/core/dex/instructions/IfNode.java
+4
-2
TestTypeResolver4.java
.../java/jadx/tests/integration/types/TestTypeResolver4.java
+52
-0
No files found.
jadx-core/src/main/java/jadx/core/dex/instructions/IfNode.java
View file @
a9c0185b
...
...
@@ -14,9 +14,11 @@ import static jadx.core.utils.BlockUtils.selectOther;
public
class
IfNode
extends
GotoNode
{
// change default types priority
private
static
final
ArgType
ARG_TYPE
=
ArgType
.
unknown
(
PrimitiveType
.
INT
,
PrimitiveType
.
OBJECT
,
PrimitiveType
.
ARRAY
,
PrimitiveType
.
BOOLEAN
,
PrimitiveType
.
SHORT
,
PrimitiveType
.
CHAR
);
PrimitiveType
.
INT
,
PrimitiveType
.
OBJECT
,
PrimitiveType
.
ARRAY
,
PrimitiveType
.
BOOLEAN
,
PrimitiveType
.
BYTE
,
PrimitiveType
.
SHORT
,
PrimitiveType
.
CHAR
);
protected
IfOp
op
;
...
...
jadx-core/src/test/java/jadx/tests/integration/types/TestTypeResolver4.java
0 → 100644
View file @
a9c0185b
package
jadx
.
tests
.
integration
.
types
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.IntegrationTest
;
import
java.util.Arrays
;
import
org.junit.Test
;
import
static
jadx
.
tests
.
api
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
public
class
TestTypeResolver4
extends
IntegrationTest
{
public
static
class
TestCls
{
private
static
String
test
(
byte
[]
strArray
,
int
offset
)
{
int
len
=
strArray
.
length
;
int
start
=
offset
+
f
(
strArray
,
offset
);
int
end
=
start
;
while
(
end
+
1
<
len
&&
(
strArray
[
end
]
!=
0
||
strArray
[
end
+
1
]
!=
0
))
{
end
+=
2
;
}
byte
[]
arr
=
Arrays
.
copyOfRange
(
strArray
,
start
,
end
);
return
new
String
(
arr
);
}
private
static
int
f
(
byte
[]
strArray
,
int
offset
)
{
return
0
;
}
public
void
check
()
{
String
test
=
test
((
"1234"
+
"utfstr\0\0"
+
"4567"
).
getBytes
(),
4
);
assertThat
(
test
,
is
(
"utfstr"
));
}
}
@Test
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsOne
(
"(strArray[end] != (byte) 0 || strArray[end + 1] != (byte) 0)"
));
}
@Test
public
void
test2
()
{
noDebugInfo
();
getClassNode
(
TestCls
.
class
);
}
}
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