Skip to content

ext/filter: encode 0xFF in FILTER_SANITIZE_ENCODED#165

Closed
iliaal wants to merge 1 commit into
PHP-8.4from
filter-sanitize-encoded-0xff
Closed

ext/filter: encode 0xFF in FILTER_SANITIZE_ENCODED#165
iliaal wants to merge 1 commit into
PHP-8.4from
filter-sanitize-encoded-0xff

Conversation

@iliaal

@iliaal iliaal commented Jul 16, 2026

Copy link
Copy Markdown
Owner

php_filter_encode_url initialized the encode bitmap with memset(tmp, 1, sizeof(tmp) - 1), leaving tmp[255] unset. On common stacks that byte stayed zero, so 0xFF was copied through unencoded under FILTER_SANITIZE_ENCODED.

Initialize the full 256-byte table so every non-allowlisted byte is percent-encoded.

php_filter_encode_url initialized the "must encode" bitmap with
memset(tmp, 1, sizeof(tmp) - 1), leaving tmp[255] unset. On common
stacks that byte stayed zero, so 0xFF was copied through unencoded.

Initialize the full 256-byte table so every non-allowlisted byte is
percent-encoded.
@iliaal
iliaal changed the base branch from master to PHP-8.4 July 16, 2026 11:26
@iliaal
iliaal force-pushed the filter-sanitize-encoded-0xff branch from 06a9292 to c8bb763 Compare July 16, 2026 11:26
@iliaal

iliaal commented Jul 16, 2026

Copy link
Copy Markdown
Owner Author

Submitted upstream as php#22762.

@iliaal iliaal closed this Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant