Project

General

Profile

Actions

Bug #19754

closed

`IO::Buffer#get_string` raises unsuitable exception for too large offset

Added by nobu (Nobuyoshi Nakada) over 1 year ago. Updated about 1 year ago.

Status:
Closed
Target version:
-
[ruby-core:114072]

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

Actions #1

Updated by nobu (Nobuyoshi Nakada) over 1 year ago

  • Description updated (diff)
Actions #2

Updated by nobu (Nobuyoshi Nakada) over 1 year ago

  • Backport changed from 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED

Updated by nobu (Nobuyoshi Nakada) over 1 year ago

  • Status changed from Open to Assigned
  • Assignee set to ioquatix (Samuel Williams)
Actions #4

Updated by nobu (Nobuyoshi Nakada) over 1 year ago

  • Status changed from Assigned to Closed

Applied in changeset git|19346c2336053b351673da030b00c704138252d8.


[Bug #19754] Make IO::Buffer#get_string check offset range (#8016)

Updated by ioquatix (Samuel Williams) over 1 year ago

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.

Updated by ioquatix (Samuel Williams) over 1 year ago

It also begs the question whether NUM2SIZET should allow negative values..

Updated by nagachika (Tomoyuki Chikanaga) about 1 year ago

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

Updated by usa (Usaku NAKAMURA) about 1 year ago

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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0