Author: bodewig Date: Fri Feb 20 16:30:45 2015 New Revision: 1661155 URL: http://svn.apache.org/r1661155 Log: revert 'fix' for COMPRESS-301 as GNU tar doesn't like embedded NULs either
Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java commons/proper/compress/trunk/src/test/resources/COMPRESS-178.tar Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java?rev=1661155&r1=1661154&r2=1661155&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java Fri Feb 20 16:30:45 2015 @@ -132,11 +132,6 @@ public class TarUtils { 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( Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java?rev=1661155&r1=1661154&r2=1661155&view=diff ============================================================================== --- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java (original) +++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java Fri Feb 20 16:30:45 2015 @@ -102,6 +102,12 @@ public class TarUtilsTest { 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) { Modified: commons/proper/compress/trunk/src/test/resources/COMPRESS-178.tar URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/COMPRESS-178.tar?rev=1661155&r1=1661154&r2=1661155&view=diff ============================================================================== Binary files - no diff available.