summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2026-05-07 14:31:30 +0900
committergit <svn-admin@ruby-lang.org>2026-05-07 05:40:09 +0000
commit1d2d4ac734ad7c14722cca63f841bcb1faa22800 (patch)
tree4d42224db7ded0d7ba830c4eb18f8f367cf91346 /test
parent66b1559d39aac8dec41a8ab4d207be9375ecf6d1 (diff)
[ruby/stringio] Cannot read into the underlying string
Fix https://hackerone.com/reports/3716987 https://github.com/ruby/stringio/commit/4ed1d6b7cf
Diffstat (limited to 'test')
-rw-r--r--test/stringio/test_stringio.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb
index aca250a85a..0f61245a8a 100644
--- a/test/stringio/test_stringio.rb
+++ b/test/stringio/test_stringio.rb
@@ -765,6 +765,8 @@ class TestStringIO < Test::Unit::TestCase
s = ""
f.read(nil, s)
assert_equal(Encoding::ASCII_8BIT, s.encoding, bug20418)
+
+ assert_raise(ArgumentError) {f.read(1, f.string)}
end
def test_readpartial
@@ -830,6 +832,7 @@ class TestStringIO < Test::Unit::TestCase
assert_raise(EOFError) { f.pread(1, 5) }
assert_raise(ArgumentError) { f.pread(-1, 0) }
+ assert_raise(ArgumentError) { f.pread(0, 0, f.string) }
assert_raise(Errno::EINVAL) { f.pread(3, -1) }
assert_raise(Errno::EINVAL) { f.pread(0, -1) }
assert_raise(IOError) { StringIO.new(nil, "w").pread(3, 0) }