
Issue #19754 has been updated by ioquatix (Samuel Williams). It also begs the question whether `NUM2SIZET` should allow negative values.. ---------------------------------------- Bug #19754: `IO::Buffer#get_string` raises unsuitable exception for too large offset https://bugs.ruby-lang.org/issues/19754#change-104558 * Author: nobu (Nobuyoshi Nakada) * Status: Closed * Priority: Normal * Assignee: ioquatix (Samuel Williams) * Backport: 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED ---------------------------------------- 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/