Values in ZIP files are unsigned.

Bug: 9695860
Change-Id: I5c12dc5f3c70a9fe081adf5bf5b6b4b3a115e7e1
(cherry picked from commit 9edf43dfcc35c761d97eb9156ac4254152ddbc55)
diff --git a/luni/src/main/java/java/util/zip/ZipEntry.java b/luni/src/main/java/java/util/zip/ZipEntry.java
index 988bd2c..75e319d 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 9b552a3..a0c34a3 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: