Skip to content

Fix GH-24740: Unbounded size of .phar/.metadata* entry in TAR phar - #24742

Open
lazerg wants to merge 2 commits into
php:masterfrom
lazerg:fix/gh-24740-phar-tar-metadata-size
Open

lazerg wants to merge 2 commits into
php:masterfrom
lazerg:fix/gh-24740-phar-tar-metadata-size

Conversation

@lazerg

@lazerg lazerg commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

The tar parser passed the header size of a .phar/.metadata* entry straight to phar_tar_process_metadata(), which allocates that many bytes before reading. A 1.5 KB tar claiming a 2 GB metadata entry hits the memory limit instead of failing to open. Now a size larger than the archive is rejected up front, the same way the LongLink check does since #24423.

Fixes #24740

@lazerg lazerg changed the title Fix GH-24740: Oversized size in tar .phar/.metadata.bin entry Fix GH-24740: Unbounded size of .phar/.metadata* entry in TAR phar Oct 26, 2026
@lazerg

lazerg commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

The MACOS_ARM64_DEBUG_NTS failure is not from this change. ext/openssl fails to build against OpenSSL 4.1 deprecations, and other master PRs fail the same way.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ext/phar: tar .phar/.metadata* entries have no upper bound on claimed size, unlike signature.bin/alias.txt -- unfixed sibling of GH-22556

1 participant