commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Bodewig (JIRA)" <>
Subject [jira] [Commented] (COMPRESS-314) TarArchiveInputStream rejects uid or gid >= 0x80000000
Date Wed, 06 May 2015 04:24:00 GMT


Stefan Bodewig commented on COMPRESS-314:

I'll create a separate issue for the ability to write entries with group ids > 07777777
and fix that first so I can create a unit test for this one :-)

> TarArchiveInputStream rejects uid or gid >= 0x80000000
> ------------------------------------------------------
>                 Key: COMPRESS-314
>                 URL:
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.10
>            Reporter: Jonathan Nieder
>            Priority: Minor
> A POSIX-format archive that came from sysdiagnose produces NumberFormatException[1] when
I try to read it with TarArchiveInputStream.
> The relevant part of the .tar file looks like this:
>    18 uid=429496729
> That's the uid of 'nobody' on Mac OS (on Mac OS, uid_t is 'unsigned int').
> POSIX doesn't say anything about the width of the uid extended header[2], so I assume
the tar file is okay. GNU tar doesn't have trouble with it.
> The relevant code, in applyPaxHeadersToCurrentEntry:
>             } else if ("gid".equals(key)){
>                 currEntry.setGroupId(Integer.parseInt(val));
> ...
>             } else if ("uid".equals(key)){
>                 currEntry.setUserId(Integer.parseInt(val));
> uid_t and gid_t are typically unsigned 32-bit integers, so these should presumably use
Long.parseLong to handle integers with the top bit set (and TarArchiveEntry would need some
modifications to handle large uid and gid, too).
> [1] java.lang.NumberFormatException: For input string: "4294967294"
>         at java.lang.NumberFormatException.forInputString(
>         at java.lang.Integer.parseInt(
>         at java.lang.Integer.parseInt(
>         at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.applyPaxHeadersToCurrentEntry(
>         at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.paxHeaders(
>         at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextTarEntry(
> [2]
> uid
> The user ID of the file owner, expressed as a decimal number using digits from the ISO/IEC
646:1991 standard. This record shall override the uid field in the following header block(s).
When used in write or copy mode, pax shall include a uid extended header record for each file
whose owner ID is greater than 2097151 (octal 7777777).

This message was sent by Atlassian JIRA

View raw message