diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-22 05:54:22 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-22 05:54:22 +0000 |
commit | 7e811007e22fd8074200e7f302e14542043718a7 (patch) | |
tree | c64a390a1ebe2bca0d45e5b3c336978d216873cb /test | |
parent | 93e44f8802e397a3b8e772d2fa022702211fedf6 (diff) |
merge revision(s) 58040,58041:
stringio.c: check character code
* ext/stringio/stringio.c (strio_ungetc): check if the character
code is valid in the encoding. reported by Ahmad Sherif
(ahmadsherif) at https://hackerone.com/reports/209593.
stringio.c: check range
* ext/stringio/stringio.c (strio_ungetc): raise RangeError instead
of TypeError at too big value, as well as IO#ungetc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@58052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/stringio/test_stringio.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index d4df7b2617..667fe3ea81 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -453,6 +453,9 @@ class TestStringIO < Test::Unit::TestCase f.ungetc("y".ord) assert_equal("y", f.getc) assert_equal("2", f.getc) + + assert_raise(RangeError) {f.ungetc(0x1ffffff)} + assert_raise(RangeError) {f.ungetc(0xffffffffffffff)} ensure f.close unless f.closed? end |