summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-27 15:35:54 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-27 15:35:54 +0000
commit5194682b72d88304b29e7d083e582b2fc8d36073 (patch)
tree4c6e5d818a68df5842268cfbccf0792eab04e1a0 /test
parent18e641dc13a169c4dcc0ca9dbed9f46cb9f248fc (diff)
merge revision(s) 58040,58041: [Backport #13353]
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_3@58160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 05a733c88b..1861ab2329 100644
--- a/test/stringio/test_stringio.rb
+++ b/test/stringio/test_stringio.rb
@@ -390,6 +390,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