Skip to content

Stop grapheme_strrev from using UBRK_DONE as a byte index - #234

Closed
iliaal wants to merge 1 commit into
masterfrom
fix/intl-grapheme-strrev-ubrk-done
Closed

Stop grapheme_strrev from using UBRK_DONE as a byte index#234
iliaal wants to merge 1 commit into
masterfrom
fix/intl-grapheme-strrev-ubrk-done

Conversation

@iliaal

@iliaal iliaal commented Aug 16, 2026

Copy link
Copy Markdown
Owner

grapheme_strrev() called ubrk_previous() inside a loop whose condition still saw the previous position, so UBRK_DONE (-1) was used as a byte offset and overwrote the result NUL. Stop when the iterator is done, and NUL-terminate the zend_string_alloc() buffer.

ubrk_previous() returns UBRK_DONE after the first boundary. The loop
condition ran before that assignment, so the body treated -1 as an
offset and wrote into the zend_string NUL. Break when the iterator is
done, and NUL-terminate the result of zend_string_alloc.
@iliaal

iliaal commented Aug 16, 2026

Copy link
Copy Markdown
Owner Author

Promoted: php#23323

@iliaal iliaal closed this Aug 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