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
ff093aee
Commit
ff093aee
authored
Jan 07, 2015
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix strings pool parsing in '.arsc' file
parent
aa691af6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
6 deletions
+23
-6
CommonBinaryParser.java
...re/src/main/java/jadx/core/xmlgen/CommonBinaryParser.java
+23
-6
No files found.
jadx-core/src/main/java/jadx/core/xmlgen/CommonBinaryParser.java
View file @
ff093aee
...
...
@@ -15,6 +15,7 @@ public class CommonBinaryParser extends ParserConstants {
long
start
=
is
.
getPos
()
-
2
;
is
.
checkInt16
(
0x001c
,
"String pool header size not 0x001c"
);
long
size
=
is
.
readUInt32
();
long
chunkEnd
=
start
+
size
;
int
stringCount
=
is
.
readInt32
();
int
styleCount
=
is
.
readInt32
();
...
...
@@ -35,12 +36,12 @@ public class CommonBinaryParser extends ParserConstants {
}
}
else
{
// UTF-16
long
stringsStartOffset
=
start
+
stringsStart
;
long
end
=
stylesStart
==
0
?
chunkEnd
:
start
+
stylesStart
;
byte
[]
strArray
=
is
.
readInt8Array
((
int
)
(
end
-
is
.
getPos
()));
for
(
int
i
=
0
;
i
<
stringCount
;
i
++)
{
// is.checkPos(stringsStartOffset + stringsOffset[i], "Expected string start");
// TODO: don't trust specified string length, read until \0
// TODO: stringsOffset can be same for different indexes
strings
[
i
]
=
is
.
readString16
();
// don't trust specified string length, read until \0
// stringsOffset can be same for different indexes
strings
[
i
]
=
extractString16
(
strArray
,
stringsOffset
[
i
]);
}
}
if
(
stylesStart
!=
0
)
{
...
...
@@ -50,10 +51,26 @@ public class CommonBinaryParser extends ParserConstants {
}
}
// skip padding zeroes
is
.
skip
(
start
+
size
-
is
.
getPos
());
is
.
skip
(
chunkEnd
-
is
.
getPos
());
return
strings
;
}
private
static
String
extractString16
(
byte
[]
strArray
,
int
offset
)
{
int
len
=
strArray
.
length
;
int
start
=
offset
+
2
;
int
end
=
start
;
while
(
true
)
{
if
(
end
+
1
>=
len
)
{
break
;
}
if
(
strArray
[
end
]
==
0
&&
strArray
[
end
+
1
]
==
0
)
{
break
;
}
end
+=
2
;
}
return
new
String
(
strArray
,
start
,
end
-
start
,
ParserStream
.
STRING_CHARSET_UTF16
);
}
protected
void
die
(
String
message
)
throws
IOException
{
throw
new
IOException
(
"Decode error: "
+
message
+
", position: 0x"
+
Long
.
toHexString
(
is
.
getPos
()));
...
...
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