<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_array.rb, 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>merge revision(s) c479492a6701dcef3d3a96de8946ecf7beb079d4: [Backport #20427]</title>
<updated>2024-05-29T22:44:55+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2024-05-29T22:44:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b44c02ad5a1c5c8c1c62b83eec96cf3a8a2107bc'/>
<id>b44c02ad5a1c5c8c1c62b83eec96cf3a8a2107bc</id>
<content type='text'>
	Resize ary when `Array#sort!` block modifies embedded ary

	In cases where `rb_ary_sort_bang` is called with a block and
	tmp is an embedded array, we need to account for the block
	potentially impacting the capacity of ary.

	ex:
	```
	var_0 = (1..70).to_a
	var_0.sort! do |var_0_block_129, var_1_block_129|
	  var_0.pop
	  var_1_block_129 &lt;=&gt; var_0_block_129
	end.shift(3)
	```

	The above example can put the array into a corrupted state
	resulting in a heap buffer overflow and possible segfault:
	```
	ERROR: AddressSanitizer: heap-buffer-overflow on address [...]
	WRITE of size 560 at 0x60b0000034f0 thread T0 [...]
	```

	This commit adds a conditional to determine when the capacity
	of ary has been modified by the provided block. If this is
	the case, ensure that the capacity of ary is adjusted to
	handle at minimum the len of tmp.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Resize ary when `Array#sort!` block modifies embedded ary

	In cases where `rb_ary_sort_bang` is called with a block and
	tmp is an embedded array, we need to account for the block
	potentially impacting the capacity of ary.

	ex:
	```
	var_0 = (1..70).to_a
	var_0.sort! do |var_0_block_129, var_1_block_129|
	  var_0.pop
	  var_1_block_129 &lt;=&gt; var_0_block_129
	end.shift(3)
	```

	The above example can put the array into a corrupted state
	resulting in a heap buffer overflow and possible segfault:
	```
	ERROR: AddressSanitizer: heap-buffer-overflow on address [...]
	WRITE of size 560 at 0x60b0000034f0 thread T0 [...]
	```

	This commit adds a conditional to determine when the capacity
	of ary has been modified by the provided block. If this is
	the case, ensure that the capacity of ary is adjusted to
	handle at minimum the len of tmp.
</pre>
</div>
</content>
</entry>
<entry>
<title>Skip under_gc_compact_stress on s390x (#10073)</title>
<updated>2024-05-29T18:13:02+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2024-02-22T22:34:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2f4fe76eff0a8c6ab7a1d2fb845453acfc3cb206'/>
<id>2f4fe76eff0a8c6ab7a1d2fb845453acfc3cb206</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix ary_make_partial_step for compaction</title>
<updated>2023-12-21T15:39:03+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-12-19T01:55:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e191bf42d2077a025c21888573f8b81688e5ea28'/>
<id>e191bf42d2077a025c21888573f8b81688e5ea28</id>
<content type='text'>
ary could change embeddedness due to compaction, so we should only get
the pointer after allocations.

The included test was crashing with:

    TestArray#test_slice_gc_compact_stress
    ruby/lib/pp.rb:192: [BUG] Segmentation fault at 0x0000000000000038
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ary could change embeddedness due to compaction, so we should only get
the pointer after allocations.

The included test was crashing with:

    TestArray#test_slice_gc_compact_stress
    ruby/lib/pp.rb:192: [BUG] Segmentation fault at 0x0000000000000038
</pre>
</div>
</content>
</entry>
<entry>
<title>Array#rassoc should try to convert to array implicitly. Fixes #20003</title>
<updated>2023-11-29T00:39:15+00:00</updated>
<author>
<name>Tema Bolshakov</name>
<email>either.free@gmail.com</email>
</author>
<published>2023-11-12T20:12:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e4a11a1283da07fd1d94535298c605caf299a834'/>
<id>e4a11a1283da07fd1d94535298c605caf299a834</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix compaction during ary_make_partial</title>
<updated>2023-11-27T17:40:26+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-11-27T16:30:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=150ed44d87e2d5b00f38019a487e05a67a303482'/>
<id>150ed44d87e2d5b00f38019a487e05a67a303482</id>
<content type='text'>
The ary_make_shared call may allocate, which can trigger a GC
compaction. This can cause the array to be embedded because it has a
length of 0.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The ary_make_shared call may allocate, which can trigger a GC
compaction. This can cause the array to be embedded because it has a
length of 0.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix Array#bsearch when block returns a non-integer numeric value</title>
<updated>2023-08-29T09:00:44+00:00</updated>
<author>
<name>Kouhei Yanagita</name>
<email>yanagi@shakenbu.org</email>
</author>
<published>2023-08-29T05:49:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a28c5151f567cada0d2f5c0c3ec4df7f97b80784'/>
<id>a28c5151f567cada0d2f5c0c3ec4df7f97b80784</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix bug in array pack with shared strings</title>
<updated>2022-11-10T14:26:37+00:00</updated>
<author>
<name>Jemma Issroff</name>
<email>jemmaissroff@gmail.com</email>
</author>
<published>2022-11-09T22:04:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=199b59f065ce6f1c13b8424f35a70c513523211b'/>
<id>199b59f065ce6f1c13b8424f35a70c513523211b</id>
<content type='text'>
If string literals are long and they become shared, we need to make them
independent before we can write to them. [Bug #19116]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If string literals are long and they become shared, we need to make them
independent before we can write to them. [Bug #19116]
</pre>
</div>
</content>
</entry>
<entry>
<title>Split tests for `Array#shuffle` and `Array#sample`</title>
<updated>2022-10-24T14:45:45+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2022-10-23T09:33:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=21fa0135a4f66e101d6225a9de1e02fade22a38c'/>
<id>21fa0135a4f66e101d6225a9de1e02fade22a38c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix Array#[] with ArithmeticSequence with negative steps (#5739)</title>
<updated>2022-08-11T10:16:49+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2022-08-11T10:16:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=cfb9624460a295e4e1723301486d89058c228e07'/>
<id>cfb9624460a295e4e1723301486d89058c228e07</id>
<content type='text'>
* Fix Array#[] with ArithmeticSequence with negative steps

Previously, Array#[] when called with an ArithmeticSequence
with a negative step did not handle all cases correctly,
especially cases involving infinite ranges, inverted ranges,
and/or exclusive ends.

Fixes [Bug #18247]

* Add Array#slice tests for ArithmeticSequence with negative step to test_array

Add tests of rb_arithmetic_sequence_beg_len_step C-API function.

* Fix ext/-test-/arith_seq/beg_len_step/depend

* Rename local variables

* Fix a variable name

Co-authored-by: Kenta Murata &lt;3959+mrkn@users.noreply.github.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Fix Array#[] with ArithmeticSequence with negative steps

Previously, Array#[] when called with an ArithmeticSequence
with a negative step did not handle all cases correctly,
especially cases involving infinite ranges, inverted ranges,
and/or exclusive ends.

Fixes [Bug #18247]

* Add Array#slice tests for ArithmeticSequence with negative step to test_array

Add tests of rb_arithmetic_sequence_beg_len_step C-API function.

* Fix ext/-test-/arith_seq/beg_len_step/depend

* Rename local variables

* Fix a variable name

Co-authored-by: Kenta Murata &lt;3959+mrkn@users.noreply.github.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Add missing write barriers to Array#replace</title>
<updated>2022-04-28T15:31:22+00:00</updated>
<author>
<name>Alan Wu</name>
<email>XrXr@users.noreply.github.com</email>
</author>
<published>2022-04-27T16:23:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c416dbb3c700173d62c2d8381e3680b8aa4482ae'/>
<id>c416dbb3c700173d62c2d8381e3680b8aa4482ae</id>
<content type='text'>
Previously it made object references without using write barriers,
creating GC inconsistencies.

See: http://ci.rvm.jp/results/trunk-gc-asserts@phosphorus-docker/3925529
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously it made object references without using write barriers,
creating GC inconsistencies.

See: http://ci.rvm.jp/results/trunk-gc-asserts@phosphorus-docker/3925529
</pre>
</div>
</content>
</entry>
</feed>
