commit | f8bf45444c49053a92f6f560c5008d5ac43aa27f | [log] [tgz] |
---|---|---|
author | Stefan Bodewig <bodewig@apache.org> | Fri Feb 20 16:30:45 2015 +0000 |
committer | Stefan Bodewig <bodewig@apache.org> | Fri Feb 20 16:30:45 2015 +0000 |
tree | dbf3b31e07c14be8decee49f06418928dcac34cf | |
parent | 4355c0d224342b5c94881b7aabb441f765867dfe [diff] |
revert 'fix' for COMPRESS-301 as GNU tar doesn't like embedded NULs either git-svn-id: https://svn.apache.org/repos/asf/commons/proper/compress/trunk@1661155 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java index 7f7d57f..94e175c 100644 --- a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java +++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
@@ -132,11 +132,6 @@ for ( ;start < end; start++) { final byte currentByte = buffer[start]; - if (currentByte == 0) { - // some archivers don't pad the whole field but just insert a NUL - // COMPRESS-301 - break; - } // CheckStyle:MagicNumber OFF if (currentByte < '0' || currentByte > '7'){ throw new IllegalArgumentException(
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java index 846b2f6..5ebbbb5 100644 --- a/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
@@ -102,6 +102,12 @@ fail("Expected IllegalArgumentException - embedded space"); } catch (IllegalArgumentException expected) { } + buffer = " 0\00007 ".getBytes(CharsetNames.UTF_8); // Invalid - embedded NUL + try { + TarUtils.parseOctal(buffer,0, buffer.length); + fail("Expected IllegalArgumentException - embedded NUL"); + } catch (IllegalArgumentException expected) { + } } private void checkRoundTripOctal(final long value, final int bufsize) {
diff --git a/src/test/resources/COMPRESS-178.tar b/src/test/resources/COMPRESS-178.tar index 7e2ca7a..6a13219 100644 --- a/src/test/resources/COMPRESS-178.tar +++ b/src/test/resources/COMPRESS-178.tar Binary files differ