[#78633] ruby/spec needs help from CRuby committers — Benoit Daloze <eregontp@...>

Currently, ruby/spec is maintained mostly by individuals and enjoys the

13 messages 2016/12/13

[ruby-core:78739] [Ruby trunk Bug#13053] Array#select! can resize to negative size

From: k@...
Date: 2016-12-20 06:01:25 UTC
List: ruby-core #78739
Issue #13053 has been reported by Kazuki Yamaguchi.

----------------------------------------
Bug #13053: Array#select! can resize to negative size
https://bugs.ruby-lang.org/issues/13053

* Author: Kazuki Yamaguchi
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED
----------------------------------------
Since Ruby 2.3 ([Feature #10714]), the following code cause the Array to be nagative number size.

~~~ruby
ary = [1,2,3,4,5]
ary.select! { |i| ary.clear if i==5; false }
p ary #=> []
p ary.size #=> -5
~~~



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next