From 684353fc03afd6e7c887b65bd18f0b3aeb98101c Mon Sep 17 00:00:00 2001 From: Jeremy Bopp Date: Sun, 11 Sep 2022 09:08:14 -0500 Subject: [Win32] Negative length `IO#sysread` Raise `ArgumentError` in `IO#sysread` on Windows when given a negative length. Fixes [Bug #18880] --- test/ruby/test_io.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index d6fcf16ddd..f791b4415d 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -2213,6 +2213,14 @@ class TestIO < Test::Unit::TestCase end) end + def test_sysread_with_negative_length + make_tempfile {|t| + open(t.path) do |f| + assert_raise(ArgumentError) { f.sysread(-1) } + end + } + end + def test_flag make_tempfile {|t| assert_raise(ArgumentError) do -- cgit v1.2.3