[php-src] Issue #25003: Parsing bugs in tar extraction (PharData)
| From: | haampie | Date: | Wed, 28 Oct 2026 15:48:46 +0000 |
| Subject: | [php-src] Issue #25003: Parsing bugs in tar extraction (PharData) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-253895@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/25003
Author: haampie
### Description
I've been building a tar test suite, [stoppels.ch/tar](https://stoppels.ch/tar/) to ensure that
different tar parsers behave the same. I'm assigning identifiers to certain ambiguities, and
providing an overview of behavior of different utils/packages.
Running this on PharData, I noticed various bugs with pax headers and links. Some relate to this
issue and to #19322:
- [N03](https://stoppels.ch/tar/N03.html): a name over 100 bytes in a pax
path is
truncated to the header's 100 bytes.
- [N27](https://stoppels.ch/tar/N27.html): a symlink whose name and target are both over 100 bytes,
in a pax path and linkpath: both are truncated. #19322 parses
path only, so the target would stay truncated.
- [N28](https://stoppels.ch/tar/N28.html): the same for a hard link: both names are truncated, and
the link is extracted as an empty file.
- [F14](https://stoppels.ch/tar/F14.html): a pax size that differs from the
header's size is ignored, which can lead to curious cases wheree PharData extracts different
files than other tar implementations for the same tar file. #19322 does not apply size
either.
- [N07](https://stoppels.ch/tar/N07.html), [N27](https://stoppels.ch/tar/N27.html): symlinks are
extracted as empty files (#19879).
- [N28](https://stoppels.ch/tar/N28.html), [S06](https://stoppels.ch/tar/S06.html): hard links are
extracted as empty files too, which #19879 does not cover
If you do not support pax records, it would be wise to reject the archive instead of skipping the
header and extracting it in a sort of best-effort manner.
See this page for all results of the test suite for PharData: https://stoppels.ch/tar/phardata.html
### PHP Version
```plain
php 8.5.12
```
### Operating System
Irrelevant