You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2020/05/23 16:51:50 UTC

[commons-compress] branch master updated (3497dcb -> f71d3dd)

This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git.


    from 3497dcb  COMPRESS-516 turn ArrayIndexOutOfBounds into IOException
     new e2b9f64  COMPRESS-520 forgot to credit theobisproject
     new f71d3dd  COMPRESS-517 make sure flags and existing fields agree with each other

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/changes/changes.xml                                        |  5 ++++-
 .../compress/archivers/zip/X5455_ExtendedTimestamp.java        |  6 ++++++
 .../compress/archivers/zip/X5455_ExtendedTimestampTest.java    | 10 ++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)


[commons-compress] 01/02: COMPRESS-520 forgot to credit theobisproject

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git

commit e2b9f6445330be3ae98fe14404e31366a5557825
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Sat May 23 18:32:43 2020 +0200

    COMPRESS-520 forgot to credit theobisproject
---
 src/changes/changes.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 20a1b1d..db5a000 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -65,7 +65,7 @@ The <action> type attribute can be add,update,fix,remove.
         when reading the first entry multiple times by random
         access.
       </action>
-      <action issue="COMPRESS-520" type="fix" date="2020-05-23">
+      <action issue="COMPRESS-520" type="fix" date="2020-05-23" due-to="Robin Schimpf">
         Removed the PowerMock dependency.
       </action>
       <action issue="COMPRESS-516" type="fix" date="2020-05-23">


[commons-compress] 02/02: COMPRESS-517 make sure flags and existing fields agree with each other

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git

commit f71d3ddd9f9ab2b6c4c072168451e6f72920398f
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Sat May 23 18:51:18 2020 +0200

    COMPRESS-517 make sure flags and existing fields agree with each other
---
 src/changes/changes.xml                                        |  3 +++
 .../compress/archivers/zip/X5455_ExtendedTimestamp.java        |  6 ++++++
 .../compress/archivers/zip/X5455_ExtendedTimestampTest.java    | 10 ++++++++++
 3 files changed, 19 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index db5a000..dcad6f0 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -73,6 +73,9 @@ The <action> type attribute can be add,update,fix,remove.
         throw the expected IOException rather than obscure
         RuntimeExceptions.
       </action>
+      <action issue="COMPRESS-517" type="fix" date="2020-05-23">
+        Improved parsing of X5455_ExtendedTimestamp ZIP extra field.
+      </action>
     </release>
     <release version="1.20" date="2020-02-08"
              description="Release 1.20">
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java b/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
index bfc0b0d..02f5bc9 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
@@ -227,14 +227,20 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
         if (bit0_modifyTimePresent && offset + 4 <= len) {
             modifyTime = new ZipLong(data, offset);
             offset += 4;
+        } else {
+            bit0_modifyTimePresent = false;
         }
         if (bit1_accessTimePresent && offset + 4 <= len) {
             accessTime = new ZipLong(data, offset);
             offset += 4;
+        } else {
+            bit1_accessTimePresent = false;
         }
         if (bit2_createTimePresent && offset + 4 <= len) {
             createTime = new ZipLong(data, offset);
             offset += 4; // NOSONAR - assignment as documentation
+        } else {
+            bit2_createTimePresent = false;
         }
     }
 
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java
index e3bd60e..51a807e 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java
@@ -39,6 +39,7 @@ import static org.apache.commons.compress.AbstractTestCase.rmdir;
 import static org.apache.commons.compress.archivers.zip.X5455_ExtendedTimestamp.ACCESS_TIME_BIT;
 import static org.apache.commons.compress.archivers.zip.X5455_ExtendedTimestamp.CREATE_TIME_BIT;
 import static org.apache.commons.compress.archivers.zip.X5455_ExtendedTimestamp.MODIFY_TIME_BIT;
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -472,6 +473,15 @@ public class X5455_ExtendedTimestampTest {
         assertEquals(0, xf.getFlags());
     }
 
+    @Test
+    public void resetsFlagsWhenLocalFileArrayIsTooShort() throws Exception {
+        final byte[] local = new byte[] {
+            7
+        }; // claims all three time values would be present, but they are not
+        xf.parseFromLocalFileData(local, 0, 1);
+        assertArrayEquals(new byte[1], xf.getLocalFileDataData());
+    }
+
     private void parseReparse(
             final ZipLong time,
             final byte[] expectedLocal,