diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2025-08-09 19:44:26 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-08-09 11:12:48 +0000 |
| commit | 31f2d8990dcebf84cbbd3fedf838babaa59554a3 (patch) | |
| tree | b7785ab2f830573068a1da06b4b9615e891e63b0 /test/stringio/test_stringio.rb | |
| parent | 23c0113932407abccddbc6ee5b297d38d2d2bb9c (diff) | |
[ruby/stringio] Fix SEGV at read/pread on null StringIO
https://github.com/ruby/stringio/commit/113dd5a55e
Diffstat (limited to 'test/stringio/test_stringio.rb')
| -rw-r--r-- | test/stringio/test_stringio.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index 4c9cf37425..8b5ab37657 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -70,6 +70,16 @@ class TestStringIO < Test::Unit::TestCase assert_nil io.getc end + def test_pread_null + io = StringIO.new(nil) + assert_raise(EOFError) { io.pread(1, 0) } + end + + def test_read_null + io = StringIO.new(nil) + assert_equal "", io.read(0) + end + def test_seek_null io = StringIO.new(nil) assert_equal(0, io.seek(0, IO::SEEK_SET)) |
