summaryrefslogtreecommitdiff
path: root/luni
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2020-04-08 11:51:21 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-04-08 11:51:21 +0000
commit044d9d2c14b56bee65fa93a66083929e5998041f (patch)
treee3a8d2d285a3f31cf4044cbabd7aa67c53b468ed /luni
parente4bc3ffb11db344ac449fc33b246b2b88a32af30 (diff)
parent1fb8789611c1f7682ac2fff915a2b42d352c0eb4 (diff)
Merge "ZipInputStream: Don't throw for data descriptors on STORed entries." into rvc-dev
Diffstat (limited to 'luni')
-rw-r--r--luni/src/test/java/libcore/java/util/zip/ZipInputStreamTest.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/luni/src/test/java/libcore/java/util/zip/ZipInputStreamTest.java b/luni/src/test/java/libcore/java/util/zip/ZipInputStreamTest.java
index 8485874bb3..8a33f6f620 100644
--- a/luni/src/test/java/libcore/java/util/zip/ZipInputStreamTest.java
+++ b/luni/src/test/java/libcore/java/util/zip/ZipInputStreamTest.java
@@ -143,6 +143,19 @@ public final class ZipInputStreamTest extends TestCaseWithRules {
zis.close();
}
+ private static final byte[] ZIP_WITH_DATA_DESCRIPTOR = new byte[] {
+(byte) 80, 75, 3, 4, 10, 0, 8, 0, 0, 0, -51, 90, -121, 80, -20, 62, -84, -103, 2, 0, 0, 0, 2, 0, 0, 0, 8, 0, 28, 0, 116, 101, 115, 116, 46, 116, 120, 116, 85, 84, 9, 0, 3, 97, 84, -116, 94, 102, 84, -116, 94, 117, 120, 11, 0, 1, 4, -119, 66, 0, 0, 4, 83, 95, 1, 0, 72, 10, 80, 75, 7, 8, -20, 62, -84, -103, 2, 0, 0, 0, 2, 0, 0, 0, 80, 75, 1, 2, 30, 3, 10, 0, 0, 0, 0, 0, -51, 90, -121, 80, -20, 62, -84, -103, 2, 0, 0, 0, 2, 0, 0, 0, 8, 0, 24, 0, 0, 0, 0, 0, 1, 0, 0, 0, -92, -127, 0, 0, 0, 0, 116, 101, 115, 116, 46, 116, 120, 116, 85, 84, 5, 0, 3, 97, 84, -116, 94, 117, 120, 11, 0, 1, 4, -119, 66, 0, 0, 4, 83, 95, 1, 0, 80, 75, 5, 6, 0, 0, 0, 0, 1, 0, 1, 0, 78, 0, 0, 0, 84, 0, 0, 0, 0, 0 };
+
+ public void testDataDescriptorOnStoredEntry() throws Exception {
+ ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(
+ ZIP_WITH_DATA_DESCRIPTOR));
+
+ ZipEntry entry = zis.getNextEntry();
+ assertEquals("test.txt", entry.getName());
+
+ zis.close();
+ }
+
private static byte[] zip(String[] names, byte[] bytes) throws IOException {
ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
ZipOutputStream zippedOut = new ZipOutputStream(bytesOut);