[ruby-core:114072] [Ruby master Bug#19754] `IO::Buffer#get_string` raises unsuitable exception for too large offset

Issue #19754 has been reported by nobu (Nobuyoshi Nakada). ---------------------------------------- Bug #19754: `IO::Buffer#get_string` raises unsuitable exception for too large offset https://bugs.ruby-lang.org/issues/19754 * Author: nobu (Nobuyoshi Nakada) * Status: Open * Priority: Normal * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- 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://bugs.ruby-lang.org/

Issue #19754 has been updated by nobu (Nobuyoshi Nakada). Status changed from Open to Assigned Assignee set to ioquatix (Samuel Williams) ---------------------------------------- Bug #19754: `IO::Buffer#get_string` raises unsuitable exception for too large offset https://bugs.ruby-lang.org/issues/19754#change-104512 * Author: nobu (Nobuyoshi Nakada) * Status: Assigned * 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/

Issue #19754 has been updated by ioquatix (Samuel Williams). This change isn't sufficient, it just protects against the invalid value of offset. We can backport it, but I don't feel strongly about whether it's required or not. ---------------------------------------- Bug #19754: `IO::Buffer#get_string` raises unsuitable exception for too large offset https://bugs.ruby-lang.org/issues/19754#change-104557 * 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/

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/

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/

Issue #19754 has been updated by usa (Usaku NAKAMURA). Backport changed from 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONE to 3.0: DONTNEED, 3.1: DONE, 3.2: DONE ruby_3_1 4f7b595815bd75706c276b03c8d445748e869f2e 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-105180 * Author: nobu (Nobuyoshi Nakada) * Status: Closed * Priority: Normal * Assignee: ioquatix (Samuel Williams) * Backport: 3.0: DONTNEED, 3.1: DONE, 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/

Issue #19754 has been updated by ioquatix (Samuel Williams). Thanks! ---------------------------------------- Bug #19754: `IO::Buffer#get_string` raises unsuitable exception for too large offset https://bugs.ruby-lang.org/issues/19754#change-105183 * Author: nobu (Nobuyoshi Nakada) * Status: Closed * Priority: Normal * Assignee: ioquatix (Samuel Williams) * Backport: 3.0: DONTNEED, 3.1: DONE, 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/
participants (4)
-
ioquatix (Samuel Williams)
-
nagachika (Tomoyuki Chikanaga)
-
nobu (Nobuyoshi Nakada)
-
usa (Usaku NAKAMURA)