Actions
Bug #19754
closed`IO::Buffer#get_string` raises unsuitable exception for too large offset
    Bug #19754:
    `IO::Buffer#get_string` raises unsuitable exception for too large offset
  
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)
        
           Updated by nobu (Nobuyoshi Nakada) over 2 years ago
          Updated by nobu (Nobuyoshi Nakada) over 2 years ago
          
          
        
        
      
      - Description updated (diff)
        
           Updated by nobu (Nobuyoshi Nakada) over 2 years ago
          Updated by nobu (Nobuyoshi Nakada) over 2 years 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) about 2 years ago
          Updated by nobu (Nobuyoshi Nakada) about 2 years ago
          
          
        
        
      
      - Status changed from Open to Assigned
- Assignee set to ioquatix (Samuel Williams)
        
           Updated by nobu (Nobuyoshi Nakada) about 2 years ago
          Updated by nobu (Nobuyoshi Nakada) about 2 years 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) about 2 years ago
          Updated by ioquatix (Samuel Williams) about 2 years 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) about 2 years ago
          Updated by ioquatix (Samuel Williams) about 2 years ago
          
          
        
        
      
      It also begs the question whether NUM2SIZET should allow negative values..
        
           Updated by nagachika (Tomoyuki Chikanaga) about 2 years ago
          Updated by nagachika (Tomoyuki Chikanaga) about 2 years 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) almost 2 years ago
          Updated by usa (Usaku NAKAMURA) almost 2 years 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.
        
           Updated by ioquatix (Samuel Williams) almost 2 years ago
          Updated by ioquatix (Samuel Williams) almost 2 years ago
          
          
        
        
      
      Thanks!
Actions