am fe39951e: Values in ZIP files are unsigned.
* commit 'fe39951ed36353002263aefef7963a8c8b9c6441':
Values in ZIP files are unsigned.
diff --git a/luni/src/main/java/java/util/zip/ZipEntry.java b/luni/src/main/java/java/util/zip/ZipEntry.java
index e2bfc8d..003d265 100644
--- a/luni/src/main/java/java/util/zip/ZipEntry.java
+++ b/luni/src/main/java/java/util/zip/ZipEntry.java
@@ -360,18 +360,18 @@
}
it.seek(10);
- 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()) & 0xffffffffL;
compressedSize = ((long) it.readInt()) & 0xffffffffL;
size = ((long) it.readInt()) & 0xffffffffL;
- nameLength = it.readShort();
- int extraLength = it.readShort();
- int commentLength = it.readShort();
+ nameLength = it.readShort() & 0xffff;
+ int extraLength = it.readShort() & 0xffff;
+ int commentLength = it.readShort() & 0xffff;
// This is a 32-bit value in the file, but a 64-bit field in this object.
it.seek(42);
diff --git a/luni/src/main/java/java/util/zip/ZipFile.java b/luni/src/main/java/java/util/zip/ZipFile.java
index 816d1b8..181e198 100644
--- a/luni/src/main/java/java/util/zip/ZipFile.java
+++ b/luni/src/main/java/java/util/zip/ZipFile.java
@@ -259,7 +259,7 @@
// the one coming in the central header.
RAFStream rafstrm = new RAFStream(raf, entry.mLocalHeaderRelOffset + 28);
DataInputStream is = new DataInputStream(rafstrm);
- 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: