Skip to content

Various parsing bugs #109

Open
Open

Description

@haampie

I'm working on a test suite tar-minefield for tar file parsing (docs: stoppels.ch/tar), with the ultimate goal to ensure implementations converge on similar behavior, reducing parser differential vulnerabilities.

During this work, I found a few bugs in Haskell's tar.

Related to pax headers:

  1. A pax header with both path and linkpath drops path. Test cases: N27 (symlink) and N28 (hard link). In this test case, GNU tar, libarchive, Python, Go and others extract a file with a 120-character name, while Haskell's tar produces one with 100 chars.
  2. The pax size is ignored. POSIX: "This record shall override the size field in the following header block(s)". See F14.
  3. For a repeated keyword, the first record wins, but according to POSIX: "When extended header records conflict, the last one given in the header shall take precedence". See N20.

Related to parsing of numeric fields:

  1. 8 and 9 are accepted as octal digits, so a size of 00000000090 is read as 72, where GNU tar, libarchive, Python and most others refuse it. See F37.
  2. A negative base-256 number is read as positive, so size of -512 becomes 512. See F29.
  3. A base-256 number that doesn't fit in 64 bits wraps around. See F30.

Activity

  1. Bodigrim commented on Nov 7, 2026

    @Bodigrim
    Contributor

    Thanks, I'll take a look!

  2. haampie commented on Nov 11, 2026

    @haampie
    Author

    Thanks @Bodigrim! In a recent blog post I documented one more string encoding issue: https://stoppels.ch/2026/11/07/the-hardest-tarball.html. The file café is extracted as café.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions