Issue #19754 has been updated by nagachika (Tomoyuki Chikanaga).
Backport changed from 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED to 3.0: DONTNEED, 3.1:
REQUIRED, 3.2: DONE
ruby_3_2 8bbf909bb561732057b533cee1618b14886e07ba merged revision(s)
19346c2336053b351673da030b00c704138252d8.
----------------------------------------
Bug #19754: `IO::Buffer#get_string` raises unsuitable exception for too large offset
https://bugs.ruby-lang.org/issues/19754#change-105101
* Author: nobu (Nobuyoshi Nakada)
* Status: Closed
* Priority: Normal
* Assignee: ioquatix (Samuel Williams)
* Backport: 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONE
----------------------------------------
The message seems suitable when both of `offset` and `length` are given.
```ruby
IO::Buffer.for("test").get_string(5, 0) #=> Specified offset+length exceeds
buffer size! (ArgumentError)
```
But without `length`, it doesn't seem to check `offset` properly.
```ruby
IO::Buffer.for("test").get_string(5) #=> negative string size (or size too
big) (ArgumentError)
```
https://github.com/ruby/ruby/pull/8016
--
https://bugs.ruby-lang.org/