Skip to content
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

ext/session: Fix GH-17541 (ext/session NULL pointer dereferencement during ID reset) #17546

Closed
wants to merge 2 commits into from

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Jan 22, 2025

Closes GH-17541

Copy link
Member

@devnexen devnexen left a comment

Choose a reason for hiding this comment

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

MSTM

@nielsdos
Copy link
Member

Simpler test:

<?php
function errorHandler($errorNumber, $errorMessage, $fileName, $lineNumber) {
    // Destroy session while emitting warning from the bogus session name in session_start
    session_destroy();
}

set_error_handler('errorHandler');

ob_start();
var_dump(session_name("\t"));
var_dump(session_start());

@@ -1462,7 +1463,10 @@ PHPAPI zend_result php_session_reset_id(void) /* {{{ */
}

if (PS(use_cookies) && PS(send_cookie)) {
php_session_send_cookie();
zend_result cookies_sent = php_session_send_cookie();
Copy link
Member

Choose a reason for hiding this comment

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

Just this change should suffice I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

I did this initially, this caused other issues that's why I did the other changes too

@Girgias Girgias changed the base branch from master to PHP-8.3 January 23, 2025 16:39
@Girgias Girgias closed this in a85666c Jan 24, 2025
@Girgias Girgias deleted the session-segfauly branch January 24, 2025 14:15
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.

SEGV session
3 participants