summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-08 17:13:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-08 17:13:55 +0000
commitcc1910b542ad5daf74df11cb87017ad9f1667bba (patch)
treed6fc507cef396b65a7d15e9245c316cd404d4e87 /test/ruby
parent85b1671b4257332ade223d9e167cea0bf0d40fdf (diff)
marshal.c: Numerics are not tainted
* include/ruby/ruby.h (OBJ_TAINTABLE, OBJ_TAINT, OBJ_INFECT), marshal.c (r_entry0): all Numerics never be tainted now. [ruby-core:57346] [Bug #8945] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_marshal.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb
index 6b7c9c105f..d0ae231d87 100644
--- a/test/ruby/test_marshal.rb
+++ b/test/ruby/test_marshal.rb
@@ -601,4 +601,14 @@ class TestMarshal < Test::Unit::TestCase
bare = "".force_encoding(Encoding::ASCII_8BIT) << packed
assert_equal(Marshal.dump(bare), Marshal.dump(packed))
end
+
+ def test_untainted_numeric
+ bug8945 = '[ruby-core:57346] [Bug #8945] Numerics never be tainted'
+ b = 1 << 32
+ b *= b until Bignum === b
+ tainted = [0, 1.0, 1.72723e-77, b].select do |x|
+ Marshal.load(Marshal.dump(x).taint).tainted?
+ end
+ assert_empty(tainted.map {|x| [x, x.class]}, bug8945)
+ end
end