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 2013/06/03 11:58:28 UTC

svn commit: r1488947 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java

Author: bodewig
Date: Mon Jun  3 09:58:27 2013
New Revision: 1488947

URL: http://svn.apache.org/r1488947
Log:
COMPRESS-229 aftermaths, properly deal with broken archives that end with an incomplete entry.  Unfortunately we don't have a test for this

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java?rev=1488947&r1=1488946&r2=1488947&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java (original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java Mon Jun  3 09:58:27 2013
@@ -250,11 +250,23 @@ public class TarArchiveInputStream exten
 
         if (currEntry.isGNULongLinkEntry()) {
             byte[] longLinkData = getLongNameData();
+            if (longLinkData == null) {
+                // Bugzilla: 40334
+                // Malformed tar file - long link entry name not followed by
+                // entry
+                return null;
+            }
             currEntry.setLinkName(encoding.decode(longLinkData));
         }
 
         if (currEntry.isGNULongNameEntry()) {
             byte[] longNameData = getLongNameData();
+            if (longNameData == null) {
+                // Bugzilla: 40334
+                // Malformed tar file - long entry name not followed by
+                // entry
+                return null;
+            }
             currEntry.setName(encoding.decode(longNameData));
         }