You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Roel van Dijk (Jira)" <ji...@apache.org> on 2025/08/18 11:19:00 UTC

[jira] [Created] (COMPRESS-707) TAR: TarUtils.verifyCheckSum throws an Exception when checksum could not be parsed

Roel van Dijk created COMPRESS-707:
--------------------------------------

             Summary: TAR: TarUtils.verifyCheckSum throws an Exception when checksum could not be parsed
                 Key: COMPRESS-707
                 URL: https://issues.apache.org/jira/browse/COMPRESS-707
             Project: Commons Compress
          Issue Type: Bug
          Components: Archivers
    Affects Versions: 1.28.0, 1.27.1
            Reporter: Roel van Dijk


When parsing a TAR entry, the checksum is read from the header and verified.

 
{code:java}
final long storedSum = parseOctal(header, TarConstants.CHKSUM_OFFSET, TarConstants.CHKSUMLEN);
{code}
When the checksum itself is invalid (e.g. the octal number could not be parsed), an exception is thrown by the method TarUtils.parseOctal :
{code:java}
java.lang.IllegalArgumentException: Invalid byte 0 at offset 4 in '4712{NUL}36{NUL}' len=8 {code}
This exception is non-descriptive, and in our opinion TarUtils.verifyCheckSum should just return false when the checksum could not be parsed.

We will open a pull request on GitHub to address this. We will include an altered version of the bla.tar test file to cover this edge case.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)