Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
libcore
Commits
9edf43df
Commit
9edf43df
authored
11 years ago
by
Elliott Hughes
Browse files
Options
Download
Email Patches
Plain Diff
Values in ZIP files are unsigned.
Bug: 9695860 Change-Id: I5c12dc5f3c70a9fe081adf5bf5b6b4b3a115e7e1
parent
10d1f630
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
luni/src/main/java/java/util/zip/ZipEntry.java
luni/src/main/java/java/util/zip/ZipEntry.java
+7
-7
luni/src/main/java/java/util/zip/ZipFile.java
luni/src/main/java/java/util/zip/ZipFile.java
+2
-2
No files found.
luni/src/main/java/java/util/zip/ZipEntry.java
View file @
9edf43df
...
...
@@ -358,24 +358,24 @@ public class ZipEntry implements ZipConstants, Cloneable {
}
it
.
seek
(
8
);
int
gpbf
=
it
.
readShort
();
int
gpbf
=
it
.
readShort
()
&
0xffff
;
if
((
gpbf
&
ZipFile
.
GPBF_UNSUPPORTED_MASK
)
!=
0
)
{
throw
new
ZipException
(
"Invalid General Purpose Bit Flag: "
+
gpbf
);
}
compressionMethod
=
it
.
readShort
();
time
=
it
.
readShort
();
modDate
=
it
.
readShort
();
compressionMethod
=
it
.
readShort
()
&
0xffff
;
time
=
it
.
readShort
()
&
0xffff
;
modDate
=
it
.
readShort
()
&
0xffff
;
// These are 32-bit values in the file, but 64-bit fields in this object.
crc
=
((
long
)
it
.
readInt
())
&
0xffffffff
L
;
compressedSize
=
((
long
)
it
.
readInt
())
&
0xffffffff
L
;
size
=
((
long
)
it
.
readInt
())
&
0xffffffff
L
;
nameLength
=
it
.
readShort
();
int
extraLength
=
it
.
readShort
();
int
commentByteCount
=
it
.
readShort
();
nameLength
=
it
.
readShort
()
&
0xffff
;
int
extraLength
=
it
.
readShort
()
&
0xffff
;
int
commentByteCount
=
it
.
readShort
()
&
0xffff
;
// This is a 32-bit value in the file, but a 64-bit field in this object.
it
.
seek
(
42
);
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/java/util/zip/ZipFile.java
View file @
9edf43df
...
...
@@ -279,7 +279,7 @@ public class ZipFile implements Closeable, ZipConstants {
// http://www.pkware.com/documents/casestudies/APPNOTE.TXT
RAFStream
rafStream
=
new
RAFStream
(
localRaf
,
entry
.
localHeaderRelOffset
+
6
);
DataInputStream
is
=
new
DataInputStream
(
rafStream
);
int
gpbf
=
Short
.
reverseBytes
(
is
.
readShort
());
int
gpbf
=
Short
.
reverseBytes
(
is
.
readShort
())
&
0xffff
;
if
((
gpbf
&
ZipFile
.
GPBF_UNSUPPORTED_MASK
)
!=
0
)
{
throw
new
ZipException
(
"Invalid General Purpose Bit Flag: "
+
gpbf
);
}
...
...
@@ -287,7 +287,7 @@ public class ZipFile implements Closeable, ZipConstants {
// At position 28 we find the length of the extra data. In some cases
// this length differs from the one coming in the central header.
is
.
skipBytes
(
20
);
int
localExtraLenOrWhatever
=
Short
.
reverseBytes
(
is
.
readShort
());
int
localExtraLenOrWhatever
=
Short
.
reverseBytes
(
is
.
readShort
())
&
0xffff
;
is
.
close
();
// Skip the name and this "extra" data or whatever it is:
...
...
This diff is collapsed.
Click to expand it.
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