Skip to content

Conversation

TimWolla
Copy link
Member

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.

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.
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.

1 participant