uri: Fix normalization memory management for uri_parser_php_parse_url.c #19600
+149
−29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.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.This is a follow-up for the issue detected in #19587.