Skip to content

ext/fileinfo: fix use after free when streams reconstruct file info - #24181

Open
DanielEScherzer wants to merge 2 commits into
php:PHP-8.6from
DanielEScherzer:fileinfo-magic-uaf
Open

DanielEScherzer wants to merge 2 commits into
php:PHP-8.6from
DanielEScherzer:fileinfo-magic-uaf

Conversation

@DanielEScherzer

Copy link
Copy Markdown
Member

In php_fileinfo_from_path(), add an option to delay retrieving the magic_set until it is needed, after user callbacks are run, by passing in the zval holding the magic, rather than the magic set directly. Additionally, reload local magic variables after calling php_fileinfo_from_path(), since user callbacks may have run.

In `php_fileinfo_from_path()`, add an option to delay retrieving the
`magic_set` until it is needed, after user callbacks are run, by passing in the
`zval` holding the magic, rather than the magic set directly. Additionally,
reload local magic variables after calling `php_fileinfo_from_path()`, since
user callbacks may have run.
@DanielEScherzer DanielEScherzer added this to the PHP 8.6 milestone Nov 1, 2026

@ndossche ndossche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't care, and certainly not about a report from embargobreaker-io

@DanielEScherzer
DanielEScherzer requested a review from bukka November 1, 2026 15:33
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.

2 participants