[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-core
Subject:    [ruby-core:92894] [Ruby trunk Bug#15889] Enumerator#each_slice size FloatDomainError with infinite e
From:       tom () hur ! st
Date:       2019-05-30 19:08:44
Message-ID: redmine.issue-15889.20190530190843.6458a0171427a111 () ruby-lang ! org
[Download RAW message or body]

Issue #15889 has been reported by Freaky (Thomas Hurst).

----------------------------------------
Bug #15889: Enumerator#each_slice size FloatDomainError with infinite enumerator
https://bugs.ruby-lang.org/issues/15889

* Author: Freaky (Thomas Hurst)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-freebsd12.0]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Calling `#size` on an infinite `each_slice` Enumerator results in a \
`FloatDomainError` exception:

``` ruby
1.step.size # => Infinity
1.step.each_slice(2).size # => FloatDomainError
```

```
Traceback (most recent call last):
...
        3: from (irb):3:in `size'
        2: from (irb):3:in `div'
        1: from (irb):3:in `floor'
FloatDomainError (Infinity)
```

Looks like `enum_each_slice_size()` is missing a guard conditional prior to calling \
`div_int()` with the slice size.

This was reported by Josh Cheek on Twitter: \
https://twitter.com/josh_cheek/status/1134123733445218304



-- 
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>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic