Project

General

Profile

« Previous | Next » 

Revision f087f2c7

Added by Jean byroot Boussier about 2 years ago

[ruby/stringio] StringIO#pread: handle 0 length like IO#pread
(https://github.com/ruby/stringio/pull/67)

Fix: https://github.com/ruby/stringio/issues/66

If length is 0, IO#pread don't even try to read the IO, it simply return
the buffer untouched if there is one or a new empty buffer otherwise.

It also doesn't validate the offset when length is 0.

cc @jdelStrother @kou (Kouhei Sutou)

https://github.com/ruby/stringio/commit/37e9279337

Co-authored-by: Jean Boussier