Skip to content

Conversation

nielsdos
Copy link
Member

No description provided.

Shm corruption with coercion in options of unserialize()
--FILE--
<?php
unserialize("{}", ["allowed_classes" => [0]]);
Copy link
Member

Choose a reason for hiding this comment

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

What happens if you have a non-stringable object as an option?

Copy link
Member Author

Choose a reason for hiding this comment

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

That will work

Copy link
Member Author

@nielsdos nielsdos Oct 11, 2025

Choose a reason for hiding this comment

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

In the sense that it will throw and exit out at the check after the loop

Copy link
Member

Choose a reason for hiding this comment

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

Cool that's the thing I was wondering about.

convert_to_string(entry);
lcname = zend_string_tolower(Z_STR_P(entry));
/* Note: cannot use zval_get_tmp_string() here as we need to keep it in class_hash for longer than this loop. */
zend_string *str = zval_get_string(entry);
Copy link
Member

Choose a reason for hiding this comment

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

Any reason for not using the try version of this API?

Copy link
Member Author

Choose a reason for hiding this comment

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

Possible, but not necessary, as we will exit at the exception check a bit later.

@nielsdos nielsdos requested a review from iluuu1994 October 13, 2025 06: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