Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix GH-19685: Segfault when bzip2 filter has invalid parameters #19702

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

Open
alexandre-daubois wants to merge 1 commit into php:PHP-8.3
base: PHP-8.3
Choose a base branch
Loading
from alexandre-daubois:stream-append-bz2-failure

Conversation

Copy link
Member

@alexandre-daubois alexandre-daubois commented Sep 4, 2025

Fix #19685

When blocks or work have invalid values, it currently let the function execution continue. Instead, we should free some resources and return null to avoid the segfault.

@@ -367,6 +367,10 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
zend_long blocks = zval_get_long(tmpzval);
if (blocks < 1 || blocks > 9) {
php_error_docref(NULL, E_WARNING, "Invalid parameter given for number of blocks to allocate (" ZEND_LONG_FMT ")", blocks);
pefree(data->strm.next_in, persistent);
Copy link
Member

@devnexen devnexen Sep 4, 2025

Choose a reason for hiding this comment

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

nit: only if you want, on master only maybe, making a goto label to cover the 3 cases.

alexandre-daubois reacted with eyes emoji
Copy link
Member

bukka commented Sep 4, 2025
edited
Loading

It should be ok in this case but breaking filter chain is sometimes not safe (might cause breaks) so I will need to review it properly - I should be properly looking to filters in 2 or 3 weeks time.

alexandre-daubois reacted with thumbs up emoji

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

@iluuu1994 iluuu1994 iluuu1994 left review comments

@devnexen devnexen devnexen left review comments

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

segmentation fault

AltStyle によって変換されたページ (->オリジナル) /