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

[ruby/bigdecimal] Remove taint checking

This removes the taint checking.  Taint support is deprecated in
Ruby 2.7 and has no effect.  I don't think removing the taint
checks in earlier ruby versions will cause any problems.

https://github.com/ruby/bigdecimal/commit/1918d466f3
This commit is contained in:
Jeremy Evans 2019-10-18 11:44:47 -07:00 committed by Hiroshi SHIBATA
parent db33ab470c
commit b38b26c62d
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 0 additions and 12 deletions

View file

@ -276,7 +276,6 @@ again:
#ifdef ENABLE_NUMERIC_STRING
case T_STRING:
StringValueCStr(v);
rb_check_safe_obj(v);
return VpCreateRbObject(RSTRING_LEN(v) + VpBaseFig() + 1,
RSTRING_PTR(v));
#endif /* ENABLE_NUMERIC_STRING */
@ -418,7 +417,6 @@ BigDecimal_load(VALUE self, VALUE str)
unsigned long m=0;
pch = (unsigned char *)StringValueCStr(str);
rb_check_safe_obj(str);
/* First get max prec */
while((*pch) != (unsigned char)'\0' && (ch = *pch++) != (unsigned char)':') {
if(!ISDIGIT(ch)) {
@ -2030,7 +2028,6 @@ BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
if (rb_scan_args(argc, argv, "01", &f) == 1) {
if (RB_TYPE_P(f, T_STRING)) {
psz = StringValueCStr(f);
rb_check_safe_obj(f);
if (*psz == ' ') {
fPlus = 1;
psz++;

View file

@ -155,15 +155,6 @@ class TestBigDecimal < Test::Unit::TestCase
end
end
def test_BigDecimal_with_tainted_string
Thread.new {
$SAFE = 1
BigDecimal('1'.taint)
}.join
ensure
$SAFE = 0
end
def test_BigDecimal_with_exception_keyword
assert_raise(ArgumentError) {
BigDecimal('.', exception: true)