<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/string.c, branch v3_3_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>string.c: guard tmp in rb_str_format_m (GH-16280)</title>
<updated>2026-03-04T06:43:44+00:00</updated>
<author>
<name>ZHIJIE XIE</name>
<email>40601688+dummyx@users.noreply.github.com</email>
</author>
<published>2026-03-02T17:40:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6cd7b1a1e9e45dd4c43c5cefc421b4c0709cdbd7'/>
<id>6cd7b1a1e9e45dd4c43c5cefc421b4c0709cdbd7</id>
<content type='text'>
[Bug #21931]

Keep tmp alive while RARRAY_CONST_PTR(tmp) is used by rb_str_format.

[alan: sunk the guard below usage]
Reviewed-by: Alan Wu &lt;XrXr@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Bug #21931]

Keep tmp alive while RARRAY_CONST_PTR(tmp) is used by rb_str_format.

[alan: sunk the guard below usage]
Reviewed-by: Alan Wu &lt;XrXr@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) d209e6f1c0a93ad3ce1cc64dd165a6b67672614d: [Backport #21715]</title>
<updated>2026-01-16T05:26:48+00:00</updated>
<author>
<name>Hiroshi SHIBATA</name>
<email>hsbt@ruby-lang.org</email>
</author>
<published>2026-01-16T05:26:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d8c21d0780e0fc061a396e66d25b7b87de3108a4'/>
<id>d8c21d0780e0fc061a396e66d25b7b87de3108a4</id>
<content type='text'>
	search_nonascii(): Replace UB pointer cast with memcpy

	Casting a pointer to create an unaligned one is undefined behavior in C
	standards. Use memcpy to express the unaligned load instead to play by
	the rules.

	Practically, this yields the same binary output in many situations
	while fixing the crash in [Bug #21715].
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	search_nonascii(): Replace UB pointer cast with memcpy

	Casting a pointer to create an unaligned one is undefined behavior in C
	standards. Use memcpy to express the unaligned load instead to play by
	the rules.

	Practically, this yields the same binary output in many situations
	while fixing the crash in [Bug #21715].
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 43dbb9a93f4de3f1170d7d18641c30e81cc08365, 2bb6fe3854e2a4854bb89bfce4eaaea9d848fd1b, 7c9dd0ecff61153b96473c6c51d5582e809da489: [Backport #21629]</title>
<updated>2025-10-08T13:56:02+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2025-10-08T13:55:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5a8d7642168f4ea0d9331fded3033c225bbc36c5'/>
<id>5a8d7642168f4ea0d9331fded3033c225bbc36c5</id>
<content type='text'>
	[PATCH] [Bug #21629] Enable `nonstring` attribute on clang 21

	[PATCH] [Bug #21629] Initialize `struct RString`

	[PATCH] [Bug #21629] Initialize `struct RArray`
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[PATCH] [Bug #21629] Enable `nonstring` attribute on clang 21

	[PATCH] [Bug #21629] Initialize `struct RString`

	[PATCH] [Bug #21629] Initialize `struct RArray`
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) b42afa1dbcbb91e89852b3b3bc72484d7f0a5528, 67b91e780798b80038dbfb39a06831918a75259f, f1f0cc14cc7d3f9be35b203e5583f9224b1e2387, 543e3a1896ae2fe3b5b954f6497d261ab5663a15, ed2806117a0b76e4439ce1a061fae21d9e116d69, 46e4c8673747de96838d2c5dec37446d23d99d88: [Backport #21497]</title>
<updated>2025-07-20T09:32:03+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2025-07-20T07:10:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=407f6c9d0528fa6aa3f382eb1dce3a58baf5d571'/>
<id>407f6c9d0528fa6aa3f382eb1dce3a58baf5d571</id>
<content type='text'>
	Suppress gcc 15 unterminated-string-initialization warnings

	Drop an ignored attribute
	MIME-Version: 1.0
	Content-Type: text/plain; charset=UTF-8
	Content-Transfer-Encoding: 8bit

	GCC 13.3.0 (Ubuntu 24.04) emits the following warning:

	../symbol.c: In function ‘rb_id_attrset’:
	../symbol.c:175:9: warning: ‘nonstring’ attribute ignored on objects of type ‘const char[][8]’ [-Wattributes]
	  175 |         RBIMPL_ATTR_NONSTRING() static const char id_types[][8] = {
	      |         ^~~~~~~~~~~~~~~~~~~~~

	Separate `__has_attribute` from `defined(__has_attribute)`

	Fix Visual C warnings:
	```
	regenc.h(121): warning C4067: unexpected tokens following preprocessor directive - expected a newline
	```

	Cast up `int` instruction code to `VALUE`

	Fix Visual C warnings:
	```
	iseq.c(3793): warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size
	iseq.c(3794): warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size
	```

	Do not let files depend on a phony target

	Detect `clock_gettime` and `clock_getres` for winpthreads
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Suppress gcc 15 unterminated-string-initialization warnings

	Drop an ignored attribute
	MIME-Version: 1.0
	Content-Type: text/plain; charset=UTF-8
	Content-Transfer-Encoding: 8bit

	GCC 13.3.0 (Ubuntu 24.04) emits the following warning:

	../symbol.c: In function ‘rb_id_attrset’:
	../symbol.c:175:9: warning: ‘nonstring’ attribute ignored on objects of type ‘const char[][8]’ [-Wattributes]
	  175 |         RBIMPL_ATTR_NONSTRING() static const char id_types[][8] = {
	      |         ^~~~~~~~~~~~~~~~~~~~~

	Separate `__has_attribute` from `defined(__has_attribute)`

	Fix Visual C warnings:
	```
	regenc.h(121): warning C4067: unexpected tokens following preprocessor directive - expected a newline
	```

	Cast up `int` instruction code to `VALUE`

	Fix Visual C warnings:
	```
	iseq.c(3793): warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size
	iseq.c(3794): warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size
	```

	Do not let files depend on a phony target

	Detect `clock_gettime` and `clock_getres` for winpthreads
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) fa85d23ff4a02985ebfe0716b0ff768f5b4fe13d: [Backport #21380]</title>
<updated>2025-06-15T03:51:29+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2025-06-15T03:51:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8908cb07829628115f7455508c2d5885ac99c939'/>
<id>8908cb07829628115f7455508c2d5885ac99c939</id>
<content type='text'>
	[Bug #21380] Prohibit modification in String#split block

	Reported at https://hackerone.com/reports/3163876
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #21380] Prohibit modification in String#split block

	Reported at https://hackerone.com/reports/3163876
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) c224ca4feaff20cab03d76439bcbfb35d4e2f6b1: [Backport #21172]</title>
<updated>2025-03-16T09:02:45+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2025-03-16T09:02:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=726bff43b462d2a1b0bc93299cf031202f7fe7a1'/>
<id>726bff43b462d2a1b0bc93299cf031202f7fe7a1</id>
<content type='text'>
	Fix a race condition with interned strings sweeping.

	[Bug #21172]

	This fixes a rare CI failure.

	The timeline of the race condition is:

	- A `"foo" oid=1` string is interned.
	- `"foo" oid=1` is no longer referenced and will be swept in the future.
	- Another `"foo" oid=2` string is interned.
	- `register_fstring` finds `"foo" oid=1`, but since it is about to be swept,
	  removes it from `fstring_table` and insert `"foo" oid=2` instead.
	- `"foo" oid=1` is swept, since it has the `RSTRING_FSTR` flag,
	  a `st_delete` is issued in `fstring_table` which removes `"foo" oid=2`.

	I don't know how to reproduce this bug consistently in a single test
	case.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix a race condition with interned strings sweeping.

	[Bug #21172]

	This fixes a rare CI failure.

	The timeline of the race condition is:

	- A `"foo" oid=1` string is interned.
	- `"foo" oid=1` is no longer referenced and will be swept in the future.
	- Another `"foo" oid=2` string is interned.
	- `register_fstring` finds `"foo" oid=1`, but since it is about to be swept,
	  removes it from `fstring_table` and insert `"foo" oid=2` instead.
	- `"foo" oid=1` is swept, since it has the `RSTRING_FSTR` flag,
	  a `st_delete` is issued in `fstring_table` which removes `"foo" oid=2`.

	I don't know how to reproduce this bug consistently in a single test
	case.
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 02b70256b5171d4b85ea7eeab836d3d7cfb3dbfc, 6b4f8945d600168bf530d21395da8293fbd5e8ba: [Backport #20909]</title>
<updated>2025-01-15T01:50:24+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2025-01-15T01:50:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1e48631e0f318a3b73cd39bdbda4619017383aac'/>
<id>1e48631e0f318a3b73cd39bdbda4619017383aac</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>String.new(capacity:) don't substract termlen (#11027)</title>
<updated>2024-06-20T17:39:20+00:00</updated>
<author>
<name>Jean byroot Boussier</name>
<email>jean.boussier+github@shopify.com</email>
</author>
<published>2024-06-20T17:39:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d1ffd5ecfa62a049b7c508f30b6912a890de1b32'/>
<id>d1ffd5ecfa62a049b7c508f30b6912a890de1b32</id>
<content type='text'>
[Bug #20585]

This was changed in 36a06efdd9f0604093dccbaf96d4e2cb17874dc8 because
`String.new(1024)` would end up allocating `1025` bytes, but the problem
with this change is that the caller may be trying to right size a String.

So instead, we should just better document the behavior of `capacity:`.

Co-authored-by: Jean Boussier &lt;jean.boussier@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Bug #20585]

This was changed in 36a06efdd9f0604093dccbaf96d4e2cb17874dc8 because
`String.new(1024)` would end up allocating `1025` bytes, but the problem
with this change is that the caller may be trying to right size a String.

So instead, we should just better document the behavior of `capacity:`.

Co-authored-by: Jean Boussier &lt;jean.boussier@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 7e4b1f8e1935a10df3c41ee60ca0987d73281126: [Backport #20322]</title>
<updated>2024-05-29T18:07:07+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2024-05-29T18:07:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=548c7cb9f517dcb8029bd9698187c81819e08edd'/>
<id>548c7cb9f517dcb8029bd9698187c81819e08edd</id>
<content type='text'>
	[Bug #20322] Fix rb_enc_interned_str_cstr null encoding

	The documentation for `rb_enc_interned_str_cstr` notes that `enc` can be
	a null pointer, but this currently causes a segmentation fault when
	trying to autoload the encoding. This commit fixes the issue by checking
	for NULL before calling `rb_enc_autoload`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #20322] Fix rb_enc_interned_str_cstr null encoding

	The documentation for `rb_enc_interned_str_cstr` notes that `enc` can be
	a null pointer, but this currently causes a segmentation fault when
	trying to autoload the encoding. This commit fixes the issue by checking
	for NULL before calling `rb_enc_autoload`.
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) e04146129ec6898dd6a9739dad2983c6e9b68056: [Backport #20292]</title>
<updated>2024-05-29T17:19:49+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2024-05-29T17:19:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f12c947192aa47b355015384e5c82cbf674023f1'/>
<id>f12c947192aa47b355015384e5c82cbf674023f1</id>
<content type='text'>
	[Bug #20292] Truncate embedded string to new capacity
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #20292] Truncate embedded string to new capacity
</pre>
</div>
</content>
</entry>
</feed>
