You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2010/06/01 15:29:41 UTC

[jira] Commented: (COMPRESS-113) TarArchiveEntry.parseTarHeader() includes the trailing space/NUL when parsing the octal size

    [ https://issues.apache.org/jira/browse/COMPRESS-113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12873995#action_12873995 ] 

Sebb commented on COMPRESS-113:
-------------------------------

TarUtils.parseOctal() currently stops processing when it detects a non-leading space or null, so "0777 7 " is not rejected.

It also ignores both leading '0' and spaces, so "0 0 0777 " is not rejected.

AFAICT, there is no format that allows embedded space or NUL, so it seems to me that these should also be rejected.

Looks like there are several conventions for terminating numeric fields:

space,NUL - mode, uid, and gid
NUL, space - checksum
space - size and mtime; POSIX
NUL - POSIX

Maybe the most portable approach for parsing octal numbers would be to allow:
- leading spaces
- 1 or 2 trailing space or NUL characters.

> TarArchiveEntry.parseTarHeader() includes the trailing space/NUL when parsing the octal size
> --------------------------------------------------------------------------------------------
>
>                 Key: COMPRESS-113
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-113
>             Project: Commons Compress
>          Issue Type: Bug
>    Affects Versions: 1.0
>            Reporter: Sebb
>             Fix For: 1.1
>
>
> TarArchiveEntry.parseTarHeader() includes the trailing space/NUL when parsing the octal size.
> Although the size field in the header is 12 bytes, the last byte is supposed to be space or NUL - i.e. only 11 octal digits are allowed for the size.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.