Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions ext/session/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,7 @@ static zend_result php_session_initialize(void)
} else if (PS(use_strict_mode) && PS(mod)->s_validate_sid &&
PS(mod)->s_validate_sid(&PS(mod_data), PS(id)) == FAILURE
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.

but, is there any guarantee that s_validate_sid (which is given the PS(id) as a paremeter) doesn't make it falsey, either directly or by accessing the global?

It looks like the chain of zend_string_release_ex and on don't actually assert that the string is present - can I suggest adding a ZEND_ASSERT(PS(id)) so that if there is ever a case where the string is absent at least there is a clear failure in debug builds?

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.

That would be a violation of the API contract, and it requires someone to write a session storage module that purposefully fucks around with it.

I was working on trying to reduce the amount of global state in ext/session to limit those sort of problems.

) {
if (PS(id)) {
zend_string_release_ex(PS(id), false);
}
zend_string_release_ex(PS(id), false);
PS(id) = PS(mod)->s_create_sid(&PS(mod_data));
if (!PS(id)) {
PS(id) = php_session_create_id(NULL);
Expand Down
Loading