History log of /PHP-8.2/ext/phar/tests/tar/gh16695_1.phpt (Results 1 – 1 of 1)
Revision Date Author Comments
# 72c02229 04-Nov-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-16695: phar:// tar parser and zero-length file header blocks

There are two issues:
1) There's an off-by-one in the check for the minimum file size for a
tar (i.e. `>` inste

Fix GH-16695: phar:// tar parser and zero-length file header blocks

There are two issues:
1) There's an off-by-one in the check for the minimum file size for a
tar (i.e. `>` instead of `>=`).
2) The loop in the tar parsing parses a header, and then unconditionally
reads the next one. However, that doesn't necessarily exist.
Instead, we remove the loop condition and check for the end of the
file before reading the next header. Note that we can't use
php_stream_eof as the flag may not be set yet when we're already at
the end.

Closes GH-16700.

show more ...