Bug #19754 closed
`IO::Buffer#get_string` raises unsuitable exception for too large offset
Added by nobu (Nobuyoshi Nakada) over 1 year ago.
Updated over 1 year ago.
Description
The message seems suitable when both of offset
and length
are given.
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.
IO :: Buffer . for ( "test" ). get_string ( 5 ) #=> negative string size (or size too big) (ArgumentError)
https://github.com/ruby/ruby/pull/8016
Description updated (diff )
Backport changed from 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED
Status changed from Open to Assigned
Assignee set to ioquatix (Samuel Williams)
Status changed from Assigned to Closed
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.
It also begs the question whether NUM2SIZET
should allow negative values..
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.
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.
Also available in: Atom
PDF
Like 0
Like 0 Like 0 Like 0 Like 0 Like 0 Like 0 Like 0 Like 0 Like 0