Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
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
66aa2f8f
Commit
66aa2f8f
authored
Mar 09, 2015
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix issues reported by coverity and code style
parent
99d831c4
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
64 additions
and
62 deletions
+64
-62
ResourceType.java
jadx-core/src/main/java/jadx/api/ResourceType.java
+1
-1
ResourcesLoader.java
jadx-core/src/main/java/jadx/api/ResourcesLoader.java
+1
-1
ConditionGen.java
jadx-core/src/main/java/jadx/core/codegen/ConditionGen.java
+1
-4
EnumMapAttr.java
...main/java/jadx/core/dex/attributes/nodes/EnumMapAttr.java
+2
-2
AccessInfo.java
jadx-core/src/main/java/jadx/core/dex/info/AccessInfo.java
+3
-3
MethodInfo.java
jadx-core/src/main/java/jadx/core/dex/info/MethodInfo.java
+3
-10
LiteralArg.java
...main/java/jadx/core/dex/instructions/args/LiteralArg.java
+1
-1
TypeImmutableArg.java
...ava/jadx/core/dex/instructions/args/TypeImmutableArg.java
+3
-1
ClassNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
+1
-1
InsnNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/InsnNode.java
+2
-1
MethodNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
+3
-3
DebugInfoParser.java
...main/java/jadx/core/dex/nodes/parser/DebugInfoParser.java
+3
-3
CodeShrinker.java
...re/src/main/java/jadx/core/dex/visitors/CodeShrinker.java
+1
-1
SimplifyVisitor.java
...src/main/java/jadx/core/dex/visitors/SimplifyVisitor.java
+1
-1
BlockSplitter.java
...ava/jadx/core/dex/visitors/blocksmaker/BlockSplitter.java
+1
-1
LoopRegionVisitor.java
...ava/jadx/core/dex/visitors/regions/LoopRegionVisitor.java
+2
-2
RegionMaker.java
...main/java/jadx/core/dex/visitors/regions/RegionMaker.java
+2
-8
DebugUtils.java
jadx-core/src/main/java/jadx/core/utils/DebugUtils.java
+2
-2
RegionUtils.java
jadx-core/src/main/java/jadx/core/utils/RegionUtils.java
+1
-1
Utils.java
jadx-core/src/main/java/jadx/core/utils/Utils.java
+4
-1
BinaryXMLParser.java
...-core/src/main/java/jadx/core/xmlgen/BinaryXMLParser.java
+2
-2
CommonBinaryParser.java
...re/src/main/java/jadx/core/xmlgen/CommonBinaryParser.java
+1
-1
ManifestAttributes.java
...re/src/main/java/jadx/core/xmlgen/ManifestAttributes.java
+10
-3
ParserConstants.java
...-core/src/main/java/jadx/core/xmlgen/ParserConstants.java
+2
-2
ParserStream.java
jadx-core/src/main/java/jadx/core/xmlgen/ParserStream.java
+2
-2
ValuesParser.java
...re/src/main/java/jadx/core/xmlgen/entry/ValuesParser.java
+2
-2
ContentArea.java
jadx-gui/src/main/java/jadx/gui/ui/ContentArea.java
+7
-2
No files found.
jadx-core/src/main/java/jadx/api/ResourceType.java
View file @
66aa2f8f
...
@@ -10,7 +10,7 @@ public enum ResourceType {
...
@@ -10,7 +10,7 @@ public enum ResourceType {
LIB
(
".so"
),
LIB
(
".so"
),
UNKNOWN
;
UNKNOWN
;
private
String
[]
exts
;
private
final
String
[]
exts
;
ResourceType
(
String
...
exts
)
{
ResourceType
(
String
...
exts
)
{
this
.
exts
=
exts
;
this
.
exts
=
exts
;
...
...
jadx-core/src/main/java/jadx/api/ResourcesLoader.java
View file @
66aa2f8f
...
@@ -28,7 +28,7 @@ public final class ResourcesLoader {
...
@@ -28,7 +28,7 @@ public final class ResourcesLoader {
private
static
final
int
READ_BUFFER_SIZE
=
8
*
1024
;
private
static
final
int
READ_BUFFER_SIZE
=
8
*
1024
;
private
static
final
int
LOAD_SIZE_LIMIT
=
10
*
1024
*
1024
;
private
static
final
int
LOAD_SIZE_LIMIT
=
10
*
1024
*
1024
;
private
JadxDecompiler
jadxRef
;
private
final
JadxDecompiler
jadxRef
;
ResourcesLoader
(
JadxDecompiler
jadxRef
)
{
ResourcesLoader
(
JadxDecompiler
jadxRef
)
{
this
.
jadxRef
=
jadxRef
;
this
.
jadxRef
=
jadxRef
;
...
...
jadx-core/src/main/java/jadx/core/codegen/ConditionGen.java
View file @
66aa2f8f
...
@@ -162,10 +162,7 @@ public class ConditionGen extends InsnGen {
...
@@ -162,10 +162,7 @@ public class ConditionGen extends InsnGen {
if
(
condition
.
isCompare
())
{
if
(
condition
.
isCompare
())
{
return
false
;
return
false
;
}
}
if
(
condition
.
getMode
()
!=
Mode
.
NOT
)
{
return
condition
.
getMode
()
!=
Mode
.
NOT
;
return
true
;
}
return
false
;
}
}
private
static
boolean
isArgWrapNeeded
(
InsnArg
arg
)
{
private
static
boolean
isArgWrapNeeded
(
InsnArg
arg
)
{
...
...
jadx-core/src/main/java/jadx/core/dex/attributes/nodes/EnumMapAttr.java
View file @
66aa2f8f
...
@@ -10,7 +10,7 @@ import java.util.Map;
...
@@ -10,7 +10,7 @@ import java.util.Map;
public
class
EnumMapAttr
implements
IAttribute
{
public
class
EnumMapAttr
implements
IAttribute
{
public
static
class
KeyValueMap
{
public
static
class
KeyValueMap
{
private
Map
<
Object
,
Object
>
map
=
new
HashMap
<
Object
,
Object
>();
private
final
Map
<
Object
,
Object
>
map
=
new
HashMap
<
Object
,
Object
>();
public
Object
get
(
Object
key
)
{
public
Object
get
(
Object
key
)
{
return
map
.
get
(
key
);
return
map
.
get
(
key
);
...
@@ -21,7 +21,7 @@ public class EnumMapAttr implements IAttribute {
...
@@ -21,7 +21,7 @@ public class EnumMapAttr implements IAttribute {
}
}
}
}
private
Map
<
FieldNode
,
KeyValueMap
>
fieldsMap
=
new
HashMap
<
FieldNode
,
KeyValueMap
>();
private
final
Map
<
FieldNode
,
KeyValueMap
>
fieldsMap
=
new
HashMap
<
FieldNode
,
KeyValueMap
>();
public
KeyValueMap
getMap
(
FieldNode
field
)
{
public
KeyValueMap
getMap
(
FieldNode
field
)
{
return
fieldsMap
.
get
(
field
);
return
fieldsMap
.
get
(
field
);
...
...
jadx-core/src/main/java/jadx/core/dex/info/AccessInfo.java
View file @
66aa2f8f
...
@@ -32,9 +32,9 @@ public class AccessInfo {
...
@@ -32,9 +32,9 @@ public class AccessInfo {
}
}
public
AccessInfo
getVisibility
()
{
public
AccessInfo
getVisibility
()
{
int
f
=
(
accFlags
&
AccessFlags
.
ACC_PUBLIC
)
int
f
=
accFlags
&
AccessFlags
.
ACC_PUBLIC
|
(
accFlags
&
AccessFlags
.
ACC_PROTECTED
)
|
accFlags
&
AccessFlags
.
ACC_PROTECTED
|
(
accFlags
&
AccessFlags
.
ACC_PRIVATE
)
;
|
accFlags
&
AccessFlags
.
ACC_PRIVATE
;
return
new
AccessInfo
(
f
,
type
);
return
new
AccessInfo
(
f
,
type
);
}
}
...
...
jadx-core/src/main/java/jadx/core/dex/info/MethodInfo.java
View file @
66aa2f8f
...
@@ -111,16 +111,9 @@ public final class MethodInfo {
...
@@ -111,16 +111,9 @@ public final class MethodInfo {
return
false
;
return
false
;
}
}
MethodInfo
other
=
(
MethodInfo
)
obj
;
MethodInfo
other
=
(
MethodInfo
)
obj
;
if
(!
shortId
.
equals
(
other
.
shortId
))
{
return
shortId
.
equals
(
other
.
shortId
)
return
false
;
&&
retType
.
equals
(
other
.
retType
)
}
&&
declClass
.
equals
(
other
.
declClass
);
if
(!
retType
.
equals
(
other
.
retType
))
{
return
false
;
}
if
(!
declClass
.
equals
(
other
.
declClass
))
{
return
false
;
}
return
true
;
}
}
@Override
@Override
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/args/LiteralArg.java
View file @
66aa2f8f
...
@@ -47,7 +47,7 @@ public final class LiteralArg extends InsnArg {
...
@@ -47,7 +47,7 @@ public final class LiteralArg extends InsnArg {
@Override
@Override
public
int
hashCode
()
{
public
int
hashCode
()
{
return
(
int
)
(
literal
^
(
literal
>>>
32
)
)
+
31
*
getType
().
hashCode
();
return
(
int
)
(
literal
^
literal
>>>
32
)
+
31
*
getType
().
hashCode
();
}
}
@Override
@Override
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/args/TypeImmutableArg.java
View file @
66aa2f8f
package
jadx
.
core
.
dex
.
instructions
.
args
;
package
jadx
.
core
.
dex
.
instructions
.
args
;
import
org.jetbrains.annotations.NotNull
;
public
class
TypeImmutableArg
extends
RegisterArg
{
public
class
TypeImmutableArg
extends
RegisterArg
{
private
boolean
isThis
;
private
boolean
isThis
;
...
@@ -36,7 +38,7 @@ public class TypeImmutableArg extends RegisterArg {
...
@@ -36,7 +38,7 @@ public class TypeImmutableArg extends RegisterArg {
}
}
@Override
@Override
void
setSVar
(
SSAVar
sVar
)
{
void
setSVar
(
@NotNull
SSAVar
sVar
)
{
if
(
isThis
)
{
if
(
isThis
)
{
sVar
.
setName
(
"this"
);
sVar
.
setName
(
"this"
);
}
}
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
View file @
66aa2f8f
...
@@ -282,7 +282,7 @@ public class ClassNode extends LineAttrNode implements ILoadable {
...
@@ -282,7 +282,7 @@ public class ClassNode extends LineAttrNode implements ILoadable {
field
=
cn
.
constFields
.
get
(
obj
);
field
=
cn
.
constFields
.
get
(
obj
);
}
}
while
(
field
==
null
while
(
field
==
null
&&
(
cn
.
clsInfo
.
getParentClass
()
!=
null
)
&&
cn
.
clsInfo
.
getParentClass
()
!=
null
&&
(
cn
=
dex
.
resolveClass
(
cn
.
clsInfo
.
getParentClass
()))
!=
null
);
&&
(
cn
=
dex
.
resolveClass
(
cn
.
clsInfo
.
getParentClass
()))
!=
null
);
if
(
field
==
null
&&
searchGlobal
)
{
if
(
field
==
null
&&
searchGlobal
)
{
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/InsnNode.java
View file @
66aa2f8f
...
@@ -74,7 +74,8 @@ public class InsnNode extends LineAttrNode {
...
@@ -74,7 +74,8 @@ public class InsnNode extends LineAttrNode {
public
boolean
containsArg
(
RegisterArg
arg
)
{
public
boolean
containsArg
(
RegisterArg
arg
)
{
for
(
InsnArg
a
:
arguments
)
{
for
(
InsnArg
a
:
arguments
)
{
if
(
a
==
arg
||
(
a
.
isRegister
()
&&
((
RegisterArg
)
a
).
getRegNum
()
==
arg
.
getRegNum
()))
{
if
(
a
==
arg
||
a
.
isRegister
()
&&
((
RegisterArg
)
a
).
getRegNum
()
==
arg
.
getRegNum
())
{
return
true
;
return
true
;
}
}
}
}
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
View file @
66aa2f8f
...
@@ -75,8 +75,8 @@ public class MethodNode extends LineAttrNode implements ILoadable {
...
@@ -75,8 +75,8 @@ public class MethodNode extends LineAttrNode implements ILoadable {
this
.
mthInfo
=
MethodInfo
.
fromDex
(
classNode
.
dex
(),
mthData
.
getMethodIndex
());
this
.
mthInfo
=
MethodInfo
.
fromDex
(
classNode
.
dex
(),
mthData
.
getMethodIndex
());
this
.
parentClass
=
classNode
;
this
.
parentClass
=
classNode
;
this
.
accFlags
=
new
AccessInfo
(
mthData
.
getAccessFlags
(),
AFType
.
METHOD
);
this
.
accFlags
=
new
AccessInfo
(
mthData
.
getAccessFlags
(),
AFType
.
METHOD
);
this
.
noCode
=
(
mthData
.
getCodeOffset
()
==
0
)
;
this
.
noCode
=
mthData
.
getCodeOffset
()
==
0
;
this
.
methodData
=
(
noCode
?
null
:
mthData
)
;
this
.
methodData
=
noCode
?
null
:
mthData
;
}
}
@Override
@Override
...
@@ -527,7 +527,7 @@ public class MethodNode extends LineAttrNode implements ILoadable {
...
@@ -527,7 +527,7 @@ public class MethodNode extends LineAttrNode implements ILoadable {
defaultArgCount
=
1
;
defaultArgCount
=
1
;
}
}
}
}
result
=
(
argsList
==
null
)
||
(
argsList
.
size
()
==
defaultArgCount
)
;
result
=
argsList
==
null
||
argsList
.
size
()
==
defaultArgCount
;
}
}
return
result
;
return
result
;
}
}
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/parser/DebugInfoParser.java
View file @
66aa2f8f
...
@@ -149,7 +149,7 @@ public class DebugInfoParser {
...
@@ -149,7 +149,7 @@ public class DebugInfoParser {
int
adjustedOpcode
=
c
-
DBG_FIRST_SPECIAL
;
int
adjustedOpcode
=
c
-
DBG_FIRST_SPECIAL
;
int
addrInc
=
adjustedOpcode
/
DBG_LINE_RANGE
;
int
addrInc
=
adjustedOpcode
/
DBG_LINE_RANGE
;
addr
=
addrChange
(
addr
,
addrInc
,
line
);
addr
=
addrChange
(
addr
,
addrInc
,
line
);
line
+=
DBG_LINE_BASE
+
(
adjustedOpcode
%
DBG_LINE_RANGE
)
;
line
+=
DBG_LINE_BASE
+
adjustedOpcode
%
DBG_LINE_RANGE
;
setLine
(
addr
,
line
);
setLine
(
addr
,
line
);
}
else
{
}
else
{
throw
new
DecodeException
(
"Unknown debug insn code: "
+
c
);
throw
new
DecodeException
(
"Unknown debug insn code: "
+
c
);
...
@@ -263,8 +263,8 @@ public class DebugInfoParser {
...
@@ -263,8 +263,8 @@ public class DebugInfoParser {
int
localStart
=
var
.
getStartAddr
();
int
localStart
=
var
.
getStartAddr
();
int
localEnd
=
var
.
getEndAddr
();
int
localEnd
=
var
.
getEndAddr
();
boolean
isIntersected
=
!(
(
localEnd
<
ssaStart
)
||
(
ssaEnd
<
localStart
)
);
boolean
isIntersected
=
!(
localEnd
<
ssaStart
||
ssaEnd
<
localStart
);
if
(
isIntersected
&&
(
ssaEnd
<=
localEnd
)
)
{
if
(
isIntersected
&&
ssaEnd
<=
localEnd
)
{
mergeRequired
=
true
;
mergeRequired
=
true
;
}
}
}
else
{
}
else
{
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/CodeShrinker.java
View file @
66aa2f8f
...
@@ -210,7 +210,7 @@ public class CodeShrinker extends AbstractVisitor {
...
@@ -210,7 +210,7 @@ public class CodeShrinker extends AbstractVisitor {
// }
// }
SSAVar
sVar
=
arg
.
getSVar
();
SSAVar
sVar
=
arg
.
getSVar
();
// allow inline only one use arg or 'this'
// allow inline only one use arg or 'this'
if
(
sVar
==
null
||
(
sVar
.
getVariableUseCount
()
!=
1
&&
!
arg
.
isThis
()
))
{
if
(
sVar
==
null
||
sVar
.
getVariableUseCount
()
!=
1
&&
!
arg
.
isThis
(
))
{
continue
;
continue
;
}
}
InsnNode
assignInsn
=
sVar
.
getAssign
().
getParentInsn
();
InsnNode
assignInsn
=
sVar
.
getAssign
().
getParentInsn
();
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/SimplifyVisitor.java
View file @
66aa2f8f
...
@@ -249,7 +249,7 @@ public class SimplifyVisitor extends AbstractVisitor {
...
@@ -249,7 +249,7 @@ public class SimplifyVisitor extends AbstractVisitor {
}
}
InsnNode
wrap
=
((
InsnWrapArg
)
arg
).
getWrapInsn
();
InsnNode
wrap
=
((
InsnWrapArg
)
arg
).
getWrapInsn
();
InsnType
wrapType
=
wrap
.
getType
();
InsnType
wrapType
=
wrap
.
getType
();
if
(
(
wrapType
!=
InsnType
.
ARITH
&&
wrapType
!=
InsnType
.
STR_CONCAT
)
if
(
wrapType
!=
InsnType
.
ARITH
&&
wrapType
!=
InsnType
.
STR_CONCAT
||
!
wrap
.
getArg
(
0
).
isInsnWrap
())
{
||
!
wrap
.
getArg
(
0
).
isInsnWrap
())
{
return
null
;
return
null
;
}
}
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/blocksmaker/BlockSplitter.java
View file @
66aa2f8f
...
@@ -194,7 +194,7 @@ public class BlockSplitter extends AbstractVisitor {
...
@@ -194,7 +194,7 @@ public class BlockSplitter extends AbstractVisitor {
private
static
boolean
isDoWhile
(
Map
<
Integer
,
BlockNode
>
blocksMap
,
BlockNode
curBlock
,
InsnNode
insn
)
{
private
static
boolean
isDoWhile
(
Map
<
Integer
,
BlockNode
>
blocksMap
,
BlockNode
curBlock
,
InsnNode
insn
)
{
// split 'do-while' block (last instruction: 'if', target this block)
// split 'do-while' block (last instruction: 'if', target this block)
if
(
insn
.
getType
()
==
InsnType
.
IF
)
{
if
(
insn
.
getType
()
==
InsnType
.
IF
)
{
IfNode
ifs
=
(
IfNode
)
(
insn
)
;
IfNode
ifs
=
(
IfNode
)
insn
;
BlockNode
targetBlock
=
blocksMap
.
get
(
ifs
.
getTarget
());
BlockNode
targetBlock
=
blocksMap
.
get
(
ifs
.
getTarget
());
if
(
targetBlock
==
curBlock
)
{
if
(
targetBlock
==
curBlock
)
{
return
true
;
return
true
;
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/regions/LoopRegionVisitor.java
View file @
66aa2f8f
...
@@ -195,7 +195,7 @@ public class LoopRegionVisitor extends AbstractVisitor implements IRegionVisitor
...
@@ -195,7 +195,7 @@ public class LoopRegionVisitor extends AbstractVisitor implements IRegionVisitor
CodeShrinker
.
shrinkMethod
(
mth
);
CodeShrinker
.
shrinkMethod
(
mth
);
if
(
arrGetInsn
.
contains
(
AFlag
.
WRAPPED
))
{
if
(
arrGetInsn
.
contains
(
AFlag
.
WRAPPED
))
{
InsnArg
wrapArg
=
BlockUtils
.
searchWrappedInsnParent
(
mth
,
arrGetInsn
);
InsnArg
wrapArg
=
BlockUtils
.
searchWrappedInsnParent
(
mth
,
arrGetInsn
);
if
(
wrapArg
!=
null
)
{
if
(
wrapArg
!=
null
&&
wrapArg
.
getParentInsn
()
!=
null
)
{
wrapArg
.
getParentInsn
().
replaceArg
(
wrapArg
,
iterVar
);
wrapArg
.
getParentInsn
().
replaceArg
(
wrapArg
,
iterVar
);
}
else
{
}
else
{
LOG
.
debug
(
" checkArrayForEach: Wrapped insn not found: {}, mth: {}"
,
arrGetInsn
,
mth
);
LOG
.
debug
(
" checkArrayForEach: Wrapped insn not found: {}, mth: {}"
,
arrGetInsn
,
mth
);
...
@@ -233,7 +233,7 @@ public class LoopRegionVisitor extends AbstractVisitor implements IRegionVisitor
...
@@ -233,7 +233,7 @@ public class LoopRegionVisitor extends AbstractVisitor implements IRegionVisitor
RegisterArg
iterVar
=
nextCall
.
getResult
();
RegisterArg
iterVar
=
nextCall
.
getResult
();
if
(
nextCall
.
contains
(
AFlag
.
WRAPPED
))
{
if
(
nextCall
.
contains
(
AFlag
.
WRAPPED
))
{
InsnArg
wrapArg
=
BlockUtils
.
searchWrappedInsnParent
(
mth
,
nextCall
);
InsnArg
wrapArg
=
BlockUtils
.
searchWrappedInsnParent
(
mth
,
nextCall
);
if
(
wrapArg
!=
null
)
{
if
(
wrapArg
!=
null
&&
wrapArg
.
getParentInsn
()
!=
null
)
{
InsnNode
parentInsn
=
wrapArg
.
getParentInsn
();
InsnNode
parentInsn
=
wrapArg
.
getParentInsn
();
if
(
parentInsn
.
getType
()
!=
InsnType
.
CHECK_CAST
)
{
if
(
parentInsn
.
getType
()
!=
InsnType
.
CHECK_CAST
)
{
parentInsn
.
replaceArg
(
wrapArg
,
iterVar
);
parentInsn
.
replaceArg
(
wrapArg
,
iterVar
);
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMaker.java
View file @
66aa2f8f
...
@@ -203,7 +203,7 @@ public class RegionMaker {
...
@@ -203,7 +203,7 @@ public class RegionMaker {
BlockNode
out
;
BlockNode
out
;
if
(
loopRegion
.
isConditionAtEnd
())
{
if
(
loopRegion
.
isConditionAtEnd
())
{
BlockNode
thenBlock
=
condInfo
.
getThenBlock
();
BlockNode
thenBlock
=
condInfo
.
getThenBlock
();
out
=
(
thenBlock
==
loopStart
?
condInfo
.
getElseBlock
()
:
thenBlock
)
;
out
=
thenBlock
==
loopStart
?
condInfo
.
getElseBlock
()
:
thenBlock
;
loopStart
.
remove
(
AType
.
LOOP
);
loopStart
.
remove
(
AType
.
LOOP
);
loop
.
getEnd
().
add
(
AFlag
.
SKIP
);
loop
.
getEnd
().
add
(
AFlag
.
SKIP
);
stack
.
addExit
(
loop
.
getEnd
());
stack
.
addExit
(
loop
.
getEnd
());
...
@@ -922,13 +922,7 @@ public class RegionMaker {
...
@@ -922,13 +922,7 @@ public class RegionMaker {
if
(
b1
==
null
||
b2
==
null
)
{
if
(
b1
==
null
||
b2
==
null
)
{
return
false
;
return
false
;
}
}
if
(
isReturnBlocks
(
b1
,
b2
))
{
return
isReturnBlocks
(
b1
,
b2
)
||
isSyntheticPath
(
b1
,
b2
);
return
true
;
}
if
(
isSyntheticPath
(
b1
,
b2
))
{
return
true
;
}
return
false
;
}
}
private
static
boolean
isSyntheticPath
(
BlockNode
b1
,
BlockNode
b2
)
{
private
static
boolean
isSyntheticPath
(
BlockNode
b1
,
BlockNode
b2
)
{
...
...
jadx-core/src/main/java/jadx/core/utils/DebugUtils.java
View file @
66aa2f8f
...
@@ -103,7 +103,7 @@ public class DebugUtils {
...
@@ -103,7 +103,7 @@ public class DebugUtils {
}
}
for
(
InsnArg
arg
:
insn
.
getArguments
())
{
for
(
InsnArg
arg
:
insn
.
getArguments
())
{
if
(
arg
instanceof
RegisterArg
)
{
if
(
arg
instanceof
RegisterArg
)
{
checkSSAVar
(
mth
,
insn
,
(
(
RegisterArg
)
arg
)
);
checkSSAVar
(
mth
,
insn
,
(
RegisterArg
)
arg
);
}
}
}
}
}
}
...
@@ -131,7 +131,7 @@ public class DebugUtils {
...
@@ -131,7 +131,7 @@ public class DebugUtils {
List
<
PhiInsn
>
phis
=
new
ArrayList
<
PhiInsn
>();
List
<
PhiInsn
>
phis
=
new
ArrayList
<
PhiInsn
>();
for
(
InsnNode
insn
:
block
.
getInstructions
())
{
for
(
InsnNode
insn
:
block
.
getInstructions
())
{
if
(
insn
.
getType
()
==
InsnType
.
PHI
)
{
if
(
insn
.
getType
()
==
InsnType
.
PHI
)
{
PhiInsn
phi
=
(
(
PhiInsn
)
insn
)
;
PhiInsn
phi
=
(
PhiInsn
)
insn
;
phis
.
add
(
phi
);
phis
.
add
(
phi
);
if
(
phi
.
getArgsCount
()
!=
phi
.
getBlockBinds
().
size
())
{
if
(
phi
.
getArgsCount
()
!=
phi
.
getBlockBinds
().
size
())
{
throw
new
JadxRuntimeException
(
"Incorrect args and binds in PHI"
);
throw
new
JadxRuntimeException
(
"Incorrect args and binds in PHI"
);
...
...
jadx-core/src/main/java/jadx/core/utils/RegionUtils.java
View file @
66aa2f8f
...
@@ -189,7 +189,7 @@ public class RegionUtils {
...
@@ -189,7 +189,7 @@ public class RegionUtils {
for
(
IContainer
b
:
r
.
getSubBlocks
())
{
for
(
IContainer
b
:
r
.
getSubBlocks
())
{
// process try block
// process try block
CatchAttr
cb
=
b
.
get
(
AType
.
CATCH_BLOCK
);
CatchAttr
cb
=
b
.
get
(
AType
.
CATCH_BLOCK
);
if
(
cb
!=
null
&&
(
b
instanceof
IRegion
)
)
{
if
(
cb
!=
null
&&
b
instanceof
IRegion
)
{
TryCatchBlock
tb
=
cb
.
getTryBlock
();
TryCatchBlock
tb
=
cb
.
getTryBlock
();
for
(
ExceptionHandler
eh
:
tb
.
getHandlers
())
{
for
(
ExceptionHandler
eh
:
tb
.
getHandlers
())
{
if
(
isRegionContainsRegion
(
eh
.
getHandlerRegion
(),
region
))
{
if
(
isRegionContainsRegion
(
eh
.
getHandlerRegion
(),
region
))
{
...
...
jadx-core/src/main/java/jadx/core/utils/Utils.java
View file @
66aa2f8f
...
@@ -85,6 +85,9 @@ public class Utils {
...
@@ -85,6 +85,9 @@ public class Utils {
}
}
public
static
String
getStackTrace
(
Throwable
throwable
)
{
public
static
String
getStackTrace
(
Throwable
throwable
)
{
if
(
throwable
==
null
)
{
return
""
;
}
StringWriter
sw
=
new
StringWriter
();
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
,
true
);
PrintWriter
pw
=
new
PrintWriter
(
sw
,
true
);
throwable
.
printStackTrace
(
pw
);
throwable
.
printStackTrace
(
pw
);
...
@@ -92,6 +95,6 @@ public class Utils {
...
@@ -92,6 +95,6 @@ public class Utils {
}
}
public
static
int
compare
(
int
x
,
int
y
)
{
public
static
int
compare
(
int
x
,
int
y
)
{
return
(
x
<
y
)
?
-
1
:
((
x
==
y
)
?
0
:
1
)
;
return
x
<
y
?
-
1
:
x
==
y
?
0
:
1
;
}
}
}
}
jadx-core/src/main/java/jadx/core/xmlgen/BinaryXMLParser.java
View file @
66aa2f8f
...
@@ -209,7 +209,7 @@ public class BinaryXMLParser extends CommonBinaryParser {
...
@@ -209,7 +209,7 @@ public class BinaryXMLParser extends CommonBinaryParser {
for
(
int
i
=
0
;
i
<
attributeCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
attributeCount
;
i
++)
{
parseAttribute
(
i
);
parseAttribute
(
i
);
writer
.
add
(
'"'
);
writer
.
add
(
'"'
);
if
(
(
i
+
1
)
<
attributeCount
)
{
if
(
i
+
1
<
attributeCount
)
{
writer
.
add
(
" "
);
writer
.
add
(
" "
);
}
}
}
}
...
@@ -267,7 +267,7 @@ public class BinaryXMLParser extends CommonBinaryParser {
...
@@ -267,7 +267,7 @@ public class BinaryXMLParser extends CommonBinaryParser {
}
}
}
else
{
}
else
{
String
str
=
valuesParser
.
decodeValue
(
attrValDataType
,
attrValData
);
String
str
=
valuesParser
.
decodeValue
(
attrValDataType
,
attrValData
);
writer
.
add
(
str
);
writer
.
add
(
str
!=
null
?
str
:
"null"
);
}
}
}
}
...
...
jadx-core/src/main/java/jadx/core/xmlgen/CommonBinaryParser.java
View file @
66aa2f8f
...
@@ -61,7 +61,7 @@ public class CommonBinaryParser extends ParserConstants {
...
@@ -61,7 +61,7 @@ public class CommonBinaryParser extends ParserConstants {
return
""
;
return
""
;
}
}
if
((
len
&
0x80
)
!=
0
)
{
if
((
len
&
0x80
)
!=
0
)
{
len
=
(
(
len
&
0x7F
)
<<
8
)
|
(
strArray
[
start
++]
&
0xFF
)
;
len
=
(
len
&
0x7F
)
<<
8
|
strArray
[
start
++]
&
0xFF
;
}
}
byte
[]
arr
=
Arrays
.
copyOfRange
(
strArray
,
start
,
start
+
len
);
byte
[]
arr
=
Arrays
.
copyOfRange
(
strArray
,
start
,
start
+
len
);
return
new
String
(
arr
,
ParserStream
.
STRING_CHARSET_UTF8
);
return
new
String
(
arr
,
ParserStream
.
STRING_CHARSET_UTF8
);
...
...
jadx-core/src/main/java/jadx/core/xmlgen/ManifestAttributes.java
View file @
66aa2f8f
...
@@ -49,9 +49,16 @@ public class ManifestAttributes {
...
@@ -49,9 +49,16 @@ public class ManifestAttributes {
private
final
Map
<
String
,
MAttr
>
attrMap
=
new
HashMap
<
String
,
MAttr
>();
private
final
Map
<
String
,
MAttr
>
attrMap
=
new
HashMap
<
String
,
MAttr
>();
public
ManifestAttributes
()
throws
Exception
{
public
ManifestAttributes
()
throws
Exception
{
InputStream
xmlStream
=
ManifestAttributes
.
class
.
getResourceAsStream
(
MANIFEST_ATTR_XML
);
InputStream
xmlStream
=
null
;
DocumentBuilder
dBuilder
=
DocumentBuilderFactory
.
newInstance
().
newDocumentBuilder
();
try
{
doc
=
dBuilder
.
parse
(
xmlStream
);
xmlStream
=
ManifestAttributes
.
class
.
getResourceAsStream
(
MANIFEST_ATTR_XML
);
DocumentBuilder
dBuilder
=
DocumentBuilderFactory
.
newInstance
().
newDocumentBuilder
();
doc
=
dBuilder
.
parse
(
xmlStream
);
}
finally
{
if
(
xmlStream
!=
null
)
{
xmlStream
.
close
();
}
}
}
}
public
void
parse
()
{
public
void
parse
()
{
...
...
jadx-core/src/main/java/jadx/core/xmlgen/ParserConstants.java
View file @
66aa2f8f
...
@@ -150,11 +150,11 @@ public class ParserConstants {
...
@@ -150,11 +150,11 @@ public class ParserConstants {
protected
static
final
int
ATTR_MANY
=
ResMakeInternal
(
9
);
protected
static
final
int
ATTR_MANY
=
ResMakeInternal
(
9
);
private
static
int
ResMakeInternal
(
int
entry
)
{
private
static
int
ResMakeInternal
(
int
entry
)
{
return
0x01000000
|
(
entry
&
0xFFFF
)
;
return
0x01000000
|
entry
&
0xFFFF
;
}
}
protected
static
boolean
isResInternalId
(
int
resid
)
{
protected
static
boolean
isResInternalId
(
int
resid
)
{
return
(
(
resid
&
0xFFFF0000
)
!=
0
&&
(
resid
&
0xFF0000
)
==
0
)
;
return
(
resid
&
0xFFFF0000
)
!=
0
&&
(
resid
&
0xFF0000
)
==
0
;
}
}
// Bit mask of allowed types, for use with ATTR_TYPE.
// Bit mask of allowed types, for use with ATTR_TYPE.
...
...
jadx-core/src/main/java/jadx/core/xmlgen/ParserStream.java
View file @
66aa2f8f
...
@@ -34,7 +34,7 @@ public class ParserStream {
...
@@ -34,7 +34,7 @@ public class ParserStream {
readPos
+=
2
;
readPos
+=
2
;
int
b1
=
input
.
read
();
int
b1
=
input
.
read
();
int
b2
=
input
.
read
();
int
b2
=
input
.
read
();
return
(
b2
&
0xFF
)
<<
8
|
(
b1
&
0xFF
)
;
return
(
b2
&
0xFF
)
<<
8
|
b1
&
0xFF
;
}
}
public
int
readInt32
()
throws
IOException
{
public
int
readInt32
()
throws
IOException
{
...
@@ -44,7 +44,7 @@ public class ParserStream {
...
@@ -44,7 +44,7 @@ public class ParserStream {
int
b2
=
in
.
read
();
int
b2
=
in
.
read
();
int
b3
=
in
.
read
();
int
b3
=
in
.
read
();
int
b4
=
in
.
read
();
int
b4
=
in
.
read
();
return
b4
<<
24
|
(
b3
&
0xFF
)
<<
16
|
(
b2
&
0xFF
)
<<
8
|
(
b1
&
0xFF
)
;
return
b4
<<
24
|
(
b3
&
0xFF
)
<<
16
|
(
b2
&
0xFF
)
<<
8
|
b1
&
0xFF
;
}
}
public
long
readUInt32
()
throws
IOException
{
public
long
readUInt32
()
throws
IOException
{
...
...
jadx-core/src/main/java/jadx/core/xmlgen/entry/ValuesParser.java
View file @
66aa2f8f
...
@@ -113,8 +113,8 @@ public class ValuesParser extends ParserConstants {
...
@@ -113,8 +113,8 @@ public class ValuesParser extends ParserConstants {
}
}
private
String
decodeComplex
(
int
data
,
boolean
isFraction
)
{
private
String
decodeComplex
(
int
data
,
boolean
isFraction
)
{
double
value
=
(
data
&
(
COMPLEX_MANTISSA_MASK
<<
COMPLEX_MANTISSA_SHIFT
)
)
double
value
=
(
data
&
COMPLEX_MANTISSA_MASK
<<
COMPLEX_MANTISSA_SHIFT
)
*
RADIX_MULTS
[
(
data
>>
COMPLEX_RADIX_SHIFT
)
&
COMPLEX_RADIX_MASK
];
*
RADIX_MULTS
[
data
>>
COMPLEX_RADIX_SHIFT
&
COMPLEX_RADIX_MASK
];
int
unitType
=
data
&
COMPLEX_UNIT_MASK
;
int
unitType
=
data
&
COMPLEX_UNIT_MASK
;
String
unit
;
String
unit
;
if
(
isFraction
)
{
if
(
isFraction
)
{
...
...
jadx-gui/src/main/java/jadx/gui/ui/ContentArea.java
View file @
66aa2f8f
...
@@ -13,6 +13,7 @@ import javax.swing.text.BadLocationException;
...
@@ -13,6 +13,7 @@ import javax.swing.text.BadLocationException;
import
javax.swing.text.Caret
;
import
javax.swing.text.Caret
;
import
javax.swing.text.DefaultCaret
;
import
javax.swing.text.DefaultCaret
;
import
java.awt.Color
;
import
java.awt.Color
;
import
java.awt.Dimension
;
import
java.awt.Point
;
import
java.awt.Point
;
import
java.awt.Rectangle
;
import
java.awt.Rectangle
;
...
@@ -135,9 +136,13 @@ class ContentArea extends RSyntaxTextArea {
...
@@ -135,9 +136,13 @@ class ContentArea extends RSyntaxTextArea {
return
;
return
;
}
}
int
extentHeight
=
viewport
.
getExtentSize
().
height
;
int
extentHeight
=
viewport
.
getExtentSize
().
height
;
int
viewHeight
=
viewport
.
getViewSize
().
height
;
Dimension
viewSize
=
viewport
.
getViewSize
();
if
(
viewSize
==
null
)
{
return
;
}
int
viewHeight
=
viewSize
.
height
;
int
y
=
Math
.
max
(
0
,
r
.
y
-
(
extentHeight
/
2
)
);
int
y
=
Math
.
max
(
0
,
r
.
y
-
extentHeight
/
2
);
y
=
Math
.
min
(
y
,
viewHeight
-
extentHeight
);
y
=
Math
.
min
(
y
,
viewHeight
-
extentHeight
);
viewport
.
setViewPosition
(
new
Point
(
0
,
y
));
viewport
.
setViewPosition
(
new
Point
(
0
,
y
));
...
...
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