Skip to content

Keep compiled RuleBasedBreakIterator rules alive for the iterator - #233

Closed
iliaal wants to merge 1 commit into
masterfrom
fix/intl-rbbi-compiled-rules-lifetime
Closed

Keep compiled RuleBasedBreakIterator rules alive for the iterator#233
iliaal wants to merge 1 commit into
masterfrom
fix/intl-rbbi-compiled-rules-lifetime

Conversation

@iliaal

@iliaal iliaal commented Aug 16, 2026

Copy link
Copy Markdown
Owner

ICU's compiled-rules constructor aliases the caller buffer. PHP passed a temporary string and did not keep it, so setText/next after that string is released can use freed memory. The object now holds a zend_string copy, released in free_obj and addref'd on clone.

The ICU compiled-rules constructor aliases the caller's buffer
(kDontAdopt). PHP passed ZSTR_VAL of a temporary and did not retain
it, so a later setText/next can use freed memory. Hold a zend_string
copy on the object and release it in free_obj; clone addrefs it.
@iliaal

iliaal commented Aug 16, 2026

Copy link
Copy Markdown
Owner Author

Promoted: php#23322

@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