Skip to content

Fix #77432: Segmentation fault on including phar file #13056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

nielsdos
Copy link
Member

phar_get_pharfp() can return NULL. In this case this is because the stream gets closed by the include code in the engine. However, the phar entry is still cached, so when the next include happens the engine tries to read from a closed (and nullified) stream.
Use the same fix as in phar_open_entry_fp(): take into account that the phar_get_pharfp() can return NULL and in that case reopen the phar archive.

phar_get_pharfp() can return NULL. In this case this is because the
stream gets closed by the include code in the engine. However, the phar
entry is still cached, so when the next include happens the engine tries
to read from a closed (and nullified) stream.
Use the same fix as in phar_open_entry_fp(): take into account that the
phar_get_pharfp() can return NULL and in that case reopen the phar
archive.
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

LGTM

@nielsdos nielsdos closed this in 1edcfcc Jan 1, 2024
@iluuu1994
Copy link
Member

iluuu1994 commented Jan 11, 2024

The test ext/phar/tests/bug77432.phpt seems to fail under certain conditions with opcache+file cache (possibly due to repetition?): https://github.com/php/php-src/actions/runs/7482989837/job/20367553182

@nielsdos Do you know what might cause this?

@nielsdos
Copy link
Member Author

The test ext/phar/tests/bug77432.phpt seems to fail under certain conditions with opcache+file cache (possibly due to repetition?): https://github.com/php/php-src/actions/runs/7482989837/job/20367553182

@nielsdos Do you know what might cause this?

I'll take a look tonight. From a quick glance it looks like opcache is making us fail (file is unlinked but because it is still cached there is no error output)

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.

3 participants