diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-13 09:45:12 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-13 09:45:12 +0000 |
commit | 6f573d2b937bd85eb08700d9fd8f63473f793783 (patch) | |
tree | 0321d1c37efcd794c0f60a77886f72f32046bb34 /test | |
parent | 63a67249bbc8f6b2732e69e6ec72cb7b6a5ff760 (diff) | |
download | ruby-6f573d2b937bd85eb08700d9fd8f63473f793783.tar.gz |
io.c: fix stack smashing
* io.c (parse_mode_enc): fix buffer overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_io_m17n.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index ea68219184..63eb4b7d88 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -2082,6 +2082,19 @@ EOT } end + def test_bom_too_long_utfname + assert_separately([], <<-'end;') # do + assert_warn(/Unsupported encoding/) { + open(IO::NULL, "r:bom|utf-" + "x" * 10000) {} + } + end; + assert_separately([], <<-'end;') # do + assert_warn(/Unsupported encoding/) { + open(IO::NULL, encoding: "bom|utf-" + "x" * 10000) {} + } + end; + end + def test_cbuf with_tmpdir { fn = "tst" |