Actions
Bug #22433
openIO#sysread and IO#pread are inconsistent for length 0 and negative numbers
Bug #22433:
IO#sysread and IO#pread are inconsistent for length 0 and negative numbers
Description
When the length is 0 and an output buffer is given, the buffer is not cleared correctly. [Bug #18421] fixed the same bug for IO#readpartial and IO#read_nonblock, but it omitted IO#sysread and IO#pread:
File.open("/dev/null"){|f|f.read(0,"abc")} #=> ""
# Returns the buffer unmodified
File.open("/dev/null"){|f|f.sysread(0,"abc")} #=> "abc"
File.open("/dev/null"){|f|f.pread(0,0,"abc")} #=> "abc"
These methods should also reject negative lengths:
Actions