diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-27 10:58:14 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-27 10:58:14 +0000 |
commit | 1bd82de99775f8b0dc1d0003e98e7ab0a4658694 (patch) | |
tree | 6d4aa8309593ac68d293e7e044ce9e731c18d61e /test | |
parent | ea83d7fd0637dd82125ed6ac7cce23c9a0c5653f (diff) |
merge revision(s) 57108: [Backport #13049]
sprintf.c: fix width underflow
* sprintf.c (rb_str_format): fix memory corruption by width
underflow. https://github.com/mruby/mruby/issues/3347
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@57219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_sprintf.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_sprintf.rb b/test/ruby/test_sprintf.rb index d429ef0ddc..3fd4736a54 100644 --- a/test/ruby/test_sprintf.rb +++ b/test/ruby/test_sprintf.rb @@ -421,4 +421,9 @@ class TestSprintf < Test::Unit::TestCase assert_equal(enc, e.message.encoding) end end + + def test_width_underflow + bug = 'https://github.com/mruby/mruby/issues/3347' + assert_equal("!", sprintf("%*c", 0, ?!.ord), bug) + end end |