1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/bigdecimal/bigdecimal.c (BigDecimal_new): stop checking string

taintness.  [Bug #5508] [ruby-core:40510]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mrkn 2012-12-02 15:09:49 +00:00
parent c1e6052bfe
commit 1fec21fe60
3 changed files with 20 additions and 2 deletions

View file

@ -1,6 +1,11 @@
Sun Dec 3 00:06:00 2012 Kenta Murata <mrkn@mrkn.jp>
* ext/bigdecimal/bigdecimal.c (BigDecimal_new): stop checking string
taintness. [Bug #5508] [ruby-core:40510]
Sun Dec 2 19:26:47 2012 Masaya Tarui <tarui@ruby-lang.org> Sun Dec 2 19:26:47 2012 Masaya Tarui <tarui@ruby-lang.org>
* thread.c (RB_GC_SAVE_MACHINE_CONTEXT, rb_gc_save_machine_context): * thread.c (RB_GC_SAVE_MACHINE_CONTEXT, rb_gc_save_machine_context):
extract rb_gc_save_machine_context to RB_GC_SAVE_MACHINE_CONTEXT. extract rb_gc_save_machine_context to RB_GC_SAVE_MACHINE_CONTEXT.
NOTE: machine_regs and machine_stack_end must be set in current scope. NOTE: machine_regs and machine_stack_end must be set in current scope.

View file

@ -2403,7 +2403,6 @@ BigDecimal_new(int argc, VALUE *argv)
break; break;
} }
StringValueCStr(iniValue); StringValueCStr(iniValue);
rb_check_safe_obj(iniValue);
return VpAlloc(mf, RSTRING_PTR(iniValue)); return VpAlloc(mf, RSTRING_PTR(iniValue));
} }

View file

@ -100,6 +100,13 @@ class TestBigDecimal < Test::Unit::TestCase
end end
end end
def test_global_new_with_tainted_string
Thread.new {
$SAFE = 1
BigDecimal('1'.taint)
}.join
end
def test_new def test_new
assert_equal(1, BigDecimal.new("1")) assert_equal(1, BigDecimal.new("1"))
assert_equal(1, BigDecimal.new("1", 1)) assert_equal(1, BigDecimal.new("1", 1))
@ -150,6 +157,13 @@ class TestBigDecimal < Test::Unit::TestCase
end end
end end
def test_new_with_tainted_string
Thread.new {
$SAFE = 1
BigDecimal.new('1'.taint)
}.join
end
def _test_mode(type) def _test_mode(type)
BigDecimal.mode(type, true) BigDecimal.mode(type, true)
assert_raise(FloatDomainError) { yield } assert_raise(FloatDomainError) { yield }