Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mutation on shared strings. #7837

Merged
merged 1 commit into from May 22, 2023

Conversation

ioquatix
Copy link
Member

@ioquatix ioquatix commented May 22, 2023

Fixes https://bugs.ruby-lang.org/issues/19084.

Relates to #6630.

When creating a mutable buffer backed by a string, ensure that rb_str_modify is invoked to detach any shared state. Otherwise, mutation can accidentally modify other strings if they are shared.

Thanks to @jemmaissroff for finding this issue.

@ioquatix ioquatix merged commit bd786e7 into ruby:master May 22, 2023
90 of 95 checks passed
@ioquatix ioquatix deleted the io-buffer-rename-data-buffer branch May 22, 2023 03:58
matzbot pushed a commit that referenced this pull request Jul 16, 2023
	Fix mutation on shared strings. (#7837)

	---
	 io_buffer.c                 | 19 ++++++++++++-------
	 test/ruby/test_io_buffer.rb |  4 ----
	 2 files changed, 12 insertions(+), 11 deletions(-)
matzbot pushed a commit that referenced this pull request Jul 25, 2023
	Fix mutation on shared strings. (#7837)

	---
	 io_buffer.c                 | 19 ++++++++++++-------
	 test/ruby/test_io_buffer.rb |  4 ----
	 2 files changed, 12 insertions(+), 11 deletions(-)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant