<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_string.rb, branch v3_2_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>merge revision(s) 02b70256b5171d4b85ea7eeab836d3d7cfb3dbfc, 6b4f8945d600168bf530d21395da8293fbd5e8ba: [Backport #20909]</title>
<updated>2024-11-30T09:34:32+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2024-11-30T09:34:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=937319126af801016d410226eb0cefc2c0b5ed32'/>
<id>937319126af801016d410226eb0cefc2c0b5ed32</id>
<content type='text'>
	Check negative integer underflow

	Many of Oniguruma functions need valid encoding strings
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Check negative integer underflow

	Many of Oniguruma functions need valid encoding strings
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "merge revision(s) e04146129ec6898dd6a9739dad2983c6e9b68056, d5080f6e8b77364483ff6727b1065e45e180f05d: [Backport #20292]"</title>
<updated>2024-07-15T02:08:50+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2024-07-15T02:08:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b5e554d03a0bd34f260e783e84f4d8a16de39a61'/>
<id>b5e554d03a0bd34f260e783e84f4d8a16de39a61</id>
<content type='text'>
This reverts commit a54c717c7a74b91a3cdf20742c355e3ea42052d1.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit a54c717c7a74b91a3cdf20742c355e3ea42052d1.
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) e04146129ec6898dd6a9739dad2983c6e9b68056, d5080f6e8b77364483ff6727b1065e45e180f05d: [Backport #20292]</title>
<updated>2024-07-15T00:26:25+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2024-07-15T00:26:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a54c717c7a74b91a3cdf20742c355e3ea42052d1'/>
<id>a54c717c7a74b91a3cdf20742c355e3ea42052d1</id>
<content type='text'>
	[Bug #20292] Truncate embedded string to new capacity

	Fix -Wsign-compare on String#initialize
	MIME-Version: 1.0
	Content-Type: text/plain; charset=UTF-8
	Content-Transfer-Encoding: 8bit

	../string.c:1886:57: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘long int’ [-Wsign-compare]
	 1886 |                 if (STR_EMBED_P(str)) RUBY_ASSERT(osize &lt;= str_embed_capa(str));
	      |                                                         ^~
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #20292] Truncate embedded string to new capacity

	Fix -Wsign-compare on String#initialize
	MIME-Version: 1.0
	Content-Type: text/plain; charset=UTF-8
	Content-Transfer-Encoding: 8bit

	../string.c:1886:57: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘long int’ [-Wsign-compare]
	 1886 |                 if (STR_EMBED_P(str)) RUBY_ASSERT(osize &lt;= str_embed_capa(str));
	      |                                                         ^~
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) ade56737e2273847426214035c0ff2340b43799a: [Backport #20190]</title>
<updated>2024-03-31T08:18:55+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2024-03-31T08:18:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=4f3ed07d5bfd581b630e4afc8b9bb170ce781e7f'/>
<id>4f3ed07d5bfd581b630e4afc8b9bb170ce781e7f</id>
<content type='text'>
	Fix coderange of invalid_encoding_string.&lt;&lt;(ord)

	Appending valid encoding character can change coderange from invalid to valid.
	Example: "\x95".force_encoding('sjis')&lt;&lt;0x5C will be a valid string "\x{955C}"
	---
	 string.c                 | 6 +++++-
	 test/ruby/test_string.rb | 3 +++
	 2 files changed, 8 insertions(+), 1 deletion(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix coderange of invalid_encoding_string.&lt;&lt;(ord)

	Appending valid encoding character can change coderange from invalid to valid.
	Example: "\x95".force_encoding('sjis')&lt;&lt;0x5C will be a valid string "\x{955C}"
	---
	 string.c                 | 6 +++++-
	 test/ruby/test_string.rb | 3 +++
	 2 files changed, 8 insertions(+), 1 deletion(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) b3d612804946e841e47d14e09b6839224a79c1a4: [Backport #20150]</title>
<updated>2024-01-18T02:50:31+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2024-01-18T02:50:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b4f8623441a8be53b643fed826ba44e933cafd7e'/>
<id>b4f8623441a8be53b643fed826ba44e933cafd7e</id>
<content type='text'>
	Fix memory leak in grapheme clusters

	[Bug #20150]

	String#grapheme_cluters and String#each_grapheme_cluster leaks memory
	because if the string is not UTF-8, then the created regex will not
	be freed.

	For example:

	    str = "hello world".encode(Encoding::UTF_32LE)

	    10.times do
	      1_000.times do
	        str.grapheme_clusters
	      end

	      puts `ps -o rss= -p #{$$}`
	    end

	Before:

	    26000
	    42256
	    59008
	    75792
	    92528
	    109232
	    125936
	    142672
	    159392
	    176160

	After:

	    9264
	    9504
	    9808
	    10000
	    10128
	    10224
	    10352
	    10544
	    10704
	    10896
	---
	 string.c                 | 98 +++++++++++++++++++++++++++++++-----------------
	 test/ruby/test_string.rb | 11 ++++++
	 2 files changed, 75 insertions(+), 34 deletions(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix memory leak in grapheme clusters

	[Bug #20150]

	String#grapheme_cluters and String#each_grapheme_cluster leaks memory
	because if the string is not UTF-8, then the created regex will not
	be freed.

	For example:

	    str = "hello world".encode(Encoding::UTF_32LE)

	    10.times do
	      1_000.times do
	        str.grapheme_clusters
	      end

	      puts `ps -o rss= -p #{$$}`
	    end

	Before:

	    26000
	    42256
	    59008
	    75792
	    92528
	    109232
	    125936
	    142672
	    159392
	    176160

	After:

	    9264
	    9504
	    9808
	    10000
	    10128
	    10224
	    10352
	    10544
	    10704
	    10896
	---
	 string.c                 | 98 +++++++++++++++++++++++++++++++-----------------
	 test/ruby/test_string.rb | 11 ++++++
	 2 files changed, 75 insertions(+), 34 deletions(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) bc3ac1872e4523334e3ed04c2bb70a55c4c43f98: [Backport #19748]</title>
<updated>2023-07-22T04:39:44+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2023-07-22T04:39:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=65d294ad019c8ac5bba12e2c9098360bacafc9e3'/>
<id>65d294ad019c8ac5bba12e2c9098360bacafc9e3</id>
<content type='text'>
	[Bug #19748] Fix out-of-bound access in `String#byteindex`

	---
	 string.c                 | 17 +++++++----------
	 test/ruby/test_string.rb |  3 +++
	 2 files changed, 10 insertions(+), 10 deletions(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #19748] Fix out-of-bound access in `String#byteindex`

	---
	 string.c                 | 17 +++++++----------
	 test/ruby/test_string.rb |  3 +++
	 2 files changed, 10 insertions(+), 10 deletions(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) f7b72462aa27716370c6bea1f2c240983aca9a55: [Backport #19356]</title>
<updated>2023-01-20T03:24:24+00:00</updated>
<author>
<name>NARUSE, Yui</name>
<email>naruse@airemix.jp</email>
</author>
<published>2023-01-20T03:24:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=373e62248c9dceb660e95f1cf05fa2a4a469cd64'/>
<id>373e62248c9dceb660e95f1cf05fa2a4a469cd64</id>
<content type='text'>
	String#bytesplice should return self

	In Feature #19314, we concluded that the return value of String#bytesplice
	should be changed from the source string to the receiver, because the source
	string is useless and confusing when extra arguments are added.

	This change should be included in Ruby 3.2.1.
	---
	 string.c                 | 4 ++--
	 test/ruby/test_string.rb | 2 +-
	 2 files changed, 3 insertions(+), 3 deletions(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	String#bytesplice should return self

	In Feature #19314, we concluded that the return value of String#bytesplice
	should be changed from the source string to the receiver, because the source
	string is useless and confusing when extra arguments are added.

	This change should be included in Ruby 3.2.1.
	---
	 string.c                 | 4 ++--
	 test/ruby/test_string.rb | 2 +-
	 2 files changed, 3 insertions(+), 3 deletions(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>Prevent segfault in String#scan with ObjectSpace.each_object</title>
<updated>2022-11-30T17:38:51+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2022-11-30T16:31:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ab4c7077cc44cd6725625562b7380a44cf462190'/>
<id>ab4c7077cc44cd6725625562b7380a44cf462190</id>
<content type='text'>
Calling `String#scan` without a block creates an incomplete MatchData
object whose `RMATCH(match)-&gt;str` is Qfalse. Usually this object is not
leaked, but it was possible to pull it by using ObjectSpace.each_object.

This change hides the internal MatchData object by using rb_obj_hide.

Fixes [Bug #19159]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Calling `String#scan` without a block creates an incomplete MatchData
object whose `RMATCH(match)-&gt;str` is Qfalse. Usually this object is not
leaked, but it was possible to pull it by using ObjectSpace.each_object.

This change hides the internal MatchData object by using rb_obj_hide.

Fixes [Bug #19159]
</pre>
</div>
</content>
</entry>
<entry>
<title>Make String#rstrip{,!} raise Encoding::CompatibilityError for broken coderange</title>
<updated>2022-11-25T02:24:42+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2022-08-24T17:31:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=571d21fd4a2e877f49b4ff918832bda9a5e8f91c'/>
<id>571d21fd4a2e877f49b4ff918832bda9a5e8f91c</id>
<content type='text'>
It's questionable whether we want to allow rstrip to work for strings
where the broken coderange occurs before the trailing whitespace and
not after, but this approach is probably simpler, and I don't think
users should expect string operations like rstrip to work on broken
strings.

In some cases, this changes rstrip to raise
Encoding::CompatibilityError instead of ArgumentError.  However, as
the problem is related to an encoding issue in the receiver, and due
not due to an issue with an argument, I think
Encoding::CompatibilityError is the more appropriate error.

Fixes [Bug #18931]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It's questionable whether we want to allow rstrip to work for strings
where the broken coderange occurs before the trailing whitespace and
not after, but this approach is probably simpler, and I don't think
users should expect string operations like rstrip to work on broken
strings.

In some cases, this changes rstrip to raise
Encoding::CompatibilityError instead of ArgumentError.  However, as
the problem is related to an encoding issue in the receiver, and due
not due to an issue with an argument, I think
Encoding::CompatibilityError is the more appropriate error.

Fixes [Bug #18931]
</pre>
</div>
</content>
</entry>
<entry>
<title>Transition frozen string to frozen root shape</title>
<updated>2022-10-19T18:06:19+00:00</updated>
<author>
<name>Jemma Issroff</name>
<email>jemmaissroff@gmail.com</email>
</author>
<published>2022-10-19T13:30:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0aaa6133ed7365e5037ccdac8b59b00fb13aa50e'/>
<id>0aaa6133ed7365e5037ccdac8b59b00fb13aa50e</id>
<content type='text'>
Co-Authored-By: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Co-Authored-By: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
