Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Quincy379
jadx
提交
fc4dcd2d
J
jadx
项目概览
Quincy379
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fc4dcd2d
编写于
1月 18, 2018
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
core: prevent some null crash on resource decoding
上级
4e07d80e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
6 deletion
+15
-6
jadx-core/src/main/java/jadx/core/xmlgen/ResXmlGen.java
jadx-core/src/main/java/jadx/core/xmlgen/ResXmlGen.java
+5
-2
jadx-core/src/main/java/jadx/core/xmlgen/entry/ValuesParser.java
...re/src/main/java/jadx/core/xmlgen/entry/ValuesParser.java
+10
-4
未找到文件。
jadx-core/src/main/java/jadx/core/xmlgen/ResXmlGen.java
浏览文件 @
fc4dcd2d
...
...
@@ -64,7 +64,7 @@ public class ResXmlGen {
cw
.
startLine
();
cw
.
add
(
'<'
).
add
(
ri
.
getTypeName
()).
add
(
' '
);
String
itemTag
=
"item"
;
if
(
ri
.
getTypeName
().
equals
(
"attr"
)
&&
ri
.
getNamedValues
().
size
()
>
0
)
{
if
(
ri
.
getTypeName
().
equals
(
"attr"
)
&&
!
ri
.
getNamedValues
().
isEmpty
()
)
{
cw
.
add
(
"name=\""
).
add
(
ri
.
getKeyName
());
int
type
=
ri
.
getNamedValues
().
get
(
0
).
getRawValue
().
getData
();
if
((
type
&
ValuesParser
.
ATTR_TYPE_ENUM
)
!=
0
)
{
...
...
@@ -126,7 +126,7 @@ public class ResXmlGen {
String
nameStr
=
vp
.
decodeNameRef
(
value
.
getNameRef
());
String
valueStr
=
vp
.
decodeValue
(
value
.
getRawValue
());
if
(!
typeName
.
equals
(
"attr"
))
{
if
(
valueStr
.
equals
(
"0"
))
{
if
(
valueStr
==
null
||
valueStr
.
equals
(
"0"
))
{
valueStr
=
"@null"
;
}
if
(
nameStr
!=
null
)
{
...
...
@@ -154,6 +154,9 @@ public class ResXmlGen {
}
private
void
addSimpleValue
(
CodeWriter
cw
,
String
typeName
,
String
itemTag
,
String
attrName
,
String
attrValue
,
String
valueStr
)
{
if
(
valueStr
==
null
)
{
return
;
}
if
(
valueStr
.
startsWith
(
"res/"
))
{
// remove duplicated resources.
return
;
...
...
jadx-core/src/main/java/jadx/core/xmlgen/entry/ValuesParser.java
浏览文件 @
fc4dcd2d
package
jadx.core.xmlgen.entry
;
import
jadx.core.xmlgen.ParserConstants
;
import
jadx.core.xmlgen.ResTableParser
;
import
java.io.BufferedInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
...
...
@@ -11,9 +8,13 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.Map
;
import
org.jetbrains.annotations.Nullable
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
jadx.core.xmlgen.ParserConstants
;
import
jadx.core.xmlgen.ResTableParser
;
public
class
ValuesParser
extends
ParserConstants
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ValuesParser
.
class
);
...
...
@@ -44,6 +45,7 @@ public class ValuesParser extends ParserConstants {
androidResMap
=
androidParser
.
getResStorage
().
getResourcesNames
();
}
@Nullable
public
String
getValueString
(
ResourceEntry
ri
)
{
RawValue
simpleValue
=
ri
.
getSimpleValue
();
if
(
simpleValue
!=
null
)
{
...
...
@@ -63,12 +65,14 @@ public class ValuesParser extends ParserConstants {
return
strList
.
toString
();
}
@Nullable
public
String
decodeValue
(
RawValue
value
)
{
int
dataType
=
value
.
getDataType
();
int
data
=
value
.
getData
();
return
decodeValue
(
dataType
,
data
);
}
@Nullable
public
String
decodeValue
(
int
dataType
,
int
data
)
{
switch
(
dataType
)
{
case
TYPE_NULL:
...
...
@@ -100,7 +104,9 @@ public class ValuesParser extends ParserConstants {
if
(
androidRi
!=
null
)
{
return
"@android:"
+
androidRi
;
}
if
(
data
==
0
)
return
"0"
;
if
(
data
==
0
)
{
return
"0"
;
}
return
"?unknown_ref: "
+
Integer
.
toHexString
(
data
);
}
return
"@"
+
ri
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录