[ruby-core:109880] [Ruby master Bug#18880] IO#sysread on Windows does not validate arguments
From:
"javanthropus (Jeremy Bopp)" <noreply@...>
Date:
2022-09-10 21:46:01 UTC
List:
ruby-core #109880
Issue #18880 has been updated by javanthropus (Jeremy Bopp). I submitted PR https://github.com/ruby/ruby/pull/6354 with a simple fix. I don't have a Windows system to test with though, so I couldn't verify that it works. ---------------------------------------- Bug #18880: IO#sysread on Windows does not validate arguments https://bugs.ruby-lang.org/issues/18880#change-99121 * Author: javanthropus (Jeremy Bopp) * Status: Open * Priority: Normal * ruby -v: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x64-mingw-ucrt] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- 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. ``` ruby r, w = IO.pipe r.sysread(-1) ``` This raises `ArgumentError` on non-Windows and `Errno::EINVAL` on Windows. -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>