зеркало из https://github.com/github/ruby.git
* 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:
Родитель
c1e6052bfe
Коммит
1fec21fe60
|
@ -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>
|
||||
|
||||
* 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.
|
||||
NOTE: machine_regs and machine_stack_end must be set in current scope.
|
||||
|
||||
|
|
|
@ -2403,7 +2403,6 @@ BigDecimal_new(int argc, VALUE *argv)
|
|||
break;
|
||||
}
|
||||
StringValueCStr(iniValue);
|
||||
rb_check_safe_obj(iniValue);
|
||||
return VpAlloc(mf, RSTRING_PTR(iniValue));
|
||||
}
|
||||
|
||||
|
|
|
@ -100,6 +100,13 @@ class TestBigDecimal < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_global_new_with_tainted_string
|
||||
Thread.new {
|
||||
$SAFE = 1
|
||||
BigDecimal('1'.taint)
|
||||
}.join
|
||||
end
|
||||
|
||||
def test_new
|
||||
assert_equal(1, BigDecimal.new("1"))
|
||||
assert_equal(1, BigDecimal.new("1", 1))
|
||||
|
@ -150,6 +157,13 @@ class TestBigDecimal < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_new_with_tainted_string
|
||||
Thread.new {
|
||||
$SAFE = 1
|
||||
BigDecimal.new('1'.taint)
|
||||
}.join
|
||||
end
|
||||
|
||||
def _test_mode(type)
|
||||
BigDecimal.mode(type, true)
|
||||
assert_raise(FloatDomainError) { yield }
|
||||
|
|
Загрузка…
Ссылка в новой задаче