Skip to content

Fix heap over-read in cli_get_prompt() for empty cli.prompt - #23415

Open
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:fix/readline-cli-prompt-empty
Open

Fix heap over-read in cli_get_prompt() for empty cli.prompt#23415
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:fix/readline-cli-prompt-empty

Conversation

@iliaal

@iliaal iliaal commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

cli_get_prompt() parsed cli.prompt with a do-while, so the empty string executed the body on the terminator and scanned heap past it. Use a while loop and return the interned empty string when nothing was appended.

The prompt parser ran as a do-while, so an empty cli.prompt executed
the body on the terminator and scanned past it. Use a while loop and
return the interned empty string when nothing was appended. No
regression test: extra unicode warnings from the over-read depend on
heap contents, so a .phpt cannot pin the bug red-before.
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