[php-src] PR #19591: uri: Fix lexbor memory management in uri_parser_whatwg.c
| From: | TimWolla | Date: | Mon, 25 Aug 2025 21:42:07 +0000 |
| Subject: | [php-src] PR #19591: uri: Fix lexbor memory management in uri_parser_whatwg.c | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-32918@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/19591
Author: TimWolla
Calling
lexbor_mraw_clean() after a specific number of parses will destroy the data for
any live Uri\WhatWg\Url objects, effectively resulting in a use-after-free.
Fix the issue by removing the periodic lexbor_mraw_clean() call. Instead we implement
php_uri_parser_whatwg_free(). This also requires to move the destruction of the lexbor
structures from RSHUTDOWN to POST_ZEND_DEACTIVATE to prevent a use-after-free in
php_uri_parser_whatwg_free() since otherwise the mraw would already have been
destroyed.