Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Aug 26, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.3)

Can you help keep this open source service alive? 💖 Please sponsor : )

Looking at the Lexbor implementation, the `lxb_url_parser_t.idna` field is
private and must not be touched from the outside. Lexbor expects to be able to
manage it by itself when destroying a parser object.

Fix the issue by putting the `lxb_unicode_idna_t` into a thread-local variable
that we own. This also avoids one level of dynamic allocation. The same is done
for the mraw.
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.
….c (#19600)

There were two issues with the previous implementation of normalization:

- `php_raw_url_decode_ex()` would be used to modify a string with RC >1.
- The return value of `php_raw_url_decode_ex()` was not used, resulting in
  incorrect string lengths when percent-encoded characters are decoded.

Additionally there was a bogus assertion that verified that strings returned
from the read handlers are RC =2, which was not the case for the
`parse_url`-based parser when repeatedly retrieving a component even without
normalization happening. Remove that assertion, since its usefulness is
questionable. Any obvious data type issues with read handlers should be
detectable when testing during development.
@pull pull bot locked and limited conversation to collaborators Aug 26, 2025
@pull pull bot added the ⤵️ pull label Aug 26, 2025
@pull pull bot merged commit e844e68 into wudi:master Aug 26, 2025
8 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant