aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-18 05:52:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-18 05:52:40 +0000
commit86f685407cabd1a4c13cc868dae9ff766dd99497 (patch)
tree215df55e4f6dd04c6be150fbced6846ab23feede /test
parentd412c73825e07791f6f7878f8d9afa925d012f02 (diff)
downloadruby-86f685407cabd1a4c13cc868dae9ff766dd99497.tar.gz
string.c: integer overflow
* string.c (rb_str_modify_expand): check integer overflow. [ruby-core:75592] [Bug #12390] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/-ext-/string/test_modify_expand.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/-ext-/string/test_modify_expand.rb b/test/-ext-/string/test_modify_expand.rb
index 5eb7a02b91..d3f5a17037 100644
--- a/test/-ext-/string/test_modify_expand.rb
+++ b/test/-ext-/string/test_modify_expand.rb
@@ -13,4 +13,13 @@ class Test_StringModifyExpand < Test::Unit::TestCase
s.replace("")
CMD
end
+
+ def test_integer_overflow
+ bug12390 = '[ruby-core:75592] [Bug #12390]'
+ s = Bug::String.new
+ long_max = (1 << (8 * RbConfig::SIZEOF['long'] - 1)) - 1
+ assert_raise(ArgumentError, bug12390) {
+ s.modify_expand!(long_max)
+ }
+ end
end