aboutsummaryrefslogtreecommitdiffstats
path: root/test/stringio
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-21 03:15:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-21 03:15:56 +0000
commit853ab8662f4cdde16f28ba775acf1be0725a25f4 (patch)
tree7d7e2db416def65f48e23b0997d31efe8d6d42a8 /test/stringio
parentd3cd2e618c1d2402c2d87da5da6811784590bf7e (diff)
downloadruby-853ab8662f4cdde16f28ba775acf1be0725a25f4.tar.gz
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/stringio')
-rw-r--r--test/stringio/test_stringio.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb
index d4df7b2617..30370f5ca6 100644
--- a/test/stringio/test_stringio.rb
+++ b/test/stringio/test_stringio.rb
@@ -453,6 +453,8 @@ 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)}
ensure
f.close unless f.closed?
end