[php-src] PR #22470: Fix use-after-free in json_encode() of a JsonSerializable object
| From: | iliaal | Date: | Fri, 26 Jun 2026 13:33:38 +0000 |
| Subject: | [php-src] PR #22470: Fix use-after-free in json_encode() of a JsonSerializable object | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36671@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22470
Author: iliaal
php_json_encode_serializable_object() keeps the object pointer and its recursion guard live across
the jsonSerialize() call. An error handler invoked during that call can drop the object's last
reference through an aliased array element, leaving the post-call recursion-guard clear and the
return-value identity check reading freed memory. Pin the object across the call. The 8.5 and master
encoder dispatches through zend_call_known_function() and gets the same fix in php-src#22469.