Project

General

Profile

Actions

Bug #18880

closed

IO#sysread on Windows does not validate arguments

Added by javanthropus (Jeremy Bopp) almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x64-mingw-ucrt]
[ruby-core:109054]

Description

When passing an invalid number of bytes to read, such as -1 , to IO#sysread on Linux, an ArgumentError is raised. On Windows Errno::EINVAL is raised instead.

r, w = IO.pipe
r.sysread(-1)

This raises ArgumentError on non-Windows and Errno::EINVAL on Windows.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0