From 5a74b23c5abee17e2041f771094014d001b9c1ba Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Sat, 13 Jun 2026 10:46:42 +0200 Subject: [PATCH 1/2] Remove mathn guards It's long gone from ruby itself --- core/complex/to_s_spec.rb | 7 ++-- core/kernel/Complex_spec.rb | 33 ++++++++---------- core/kernel/Rational_spec.rb | 11 +++--- core/rational/exponent_spec.rb | 62 +++++++++++++++------------------- core/rational/inspect_spec.rb | 5 +-- core/rational/integer_spec.rb | 7 ++-- core/rational/round_spec.rb | 7 ++-- core/rational/to_s_spec.rb | 7 ++-- language/precedence_spec.rb | 5 +-- library/matrix/divide_spec.rb | 13 +++---- library/matrix/real_spec.rb | 7 ++-- 11 files changed, 64 insertions(+), 100 deletions(-) diff --git a/core/complex/to_s_spec.rb b/core/complex/to_s_spec.rb index ceccffe470..ddd6dccf7d 100644 --- a/core/complex/to_s_spec.rb +++ b/core/complex/to_s_spec.rb @@ -16,11 +16,8 @@ Complex(1, -5).to_s.should == "1-5i" Complex(-2.5, -1.5).to_s.should == "-2.5-1.5i" - # Guard against the Mathn library - guard -> { !defined?(Math.rsqrt) } do - Complex(1, 0).to_s.should == "1+0i" - Complex(1, -0).to_s.should == "1+0i" - end + Complex(1, 0).to_s.should == "1+0i" + Complex(1, -0).to_s.should == "1+0i" end it "returns 1+0.0i for Complex(1, 0.0)" do diff --git a/core/kernel/Complex_spec.rb b/core/kernel/Complex_spec.rb index a50d3f118a..a3887953de 100644 --- a/core/kernel/Complex_spec.rb +++ b/core/kernel/Complex_spec.rb @@ -43,24 +43,21 @@ describe "when passed [Integer/Float]" do it "returns a new Complex number with 0 as the imaginary component" do - # Guard against the Mathn library - guard -> { !defined?(Math.rsqrt) } do - Complex(1).should.instance_of?(Complex) - Complex(1).imag.should == 0 - Complex(1).real.should == 1 - - Complex(-3).should.instance_of?(Complex) - Complex(-3).imag.should == 0 - Complex(-3).real.should == -3 - - Complex(-4.5).should.instance_of?(Complex) - Complex(-4.5).imag.should == 0 - Complex(-4.5).real.should == -4.5 - - Complex(bignum_value).should.instance_of?(Complex) - Complex(bignum_value).imag.should == 0 - Complex(bignum_value).real.should == bignum_value - end + Complex(1).should.instance_of?(Complex) + Complex(1).imag.should == 0 + Complex(1).real.should == 1 + + Complex(-3).should.instance_of?(Complex) + Complex(-3).imag.should == 0 + Complex(-3).real.should == -3 + + Complex(-4.5).should.instance_of?(Complex) + Complex(-4.5).imag.should == 0 + Complex(-4.5).real.should == -4.5 + + Complex(bignum_value).should.instance_of?(Complex) + Complex(bignum_value).imag.should == 0 + Complex(bignum_value).real.should == bignum_value end end diff --git a/core/kernel/Rational_spec.rb b/core/kernel/Rational_spec.rb index f425cf202c..7ffa314a53 100644 --- a/core/kernel/Rational_spec.rb +++ b/core/kernel/Rational_spec.rb @@ -7,13 +7,10 @@ end describe "passed Integer" do - # Guard against the Mathn library - guard -> { !defined?(Math.rsqrt) } do - it "returns a new Rational number with 1 as the denominator" do - Rational(1).should.eql?(Rational(1, 1)) - Rational(-3).should.eql?(Rational(-3, 1)) - Rational(bignum_value).should.eql?(Rational(bignum_value, 1)) - end + it "returns a new Rational number with 1 as the denominator" do + Rational(1).should.eql?(Rational(1, 1)) + Rational(-3).should.eql?(Rational(-3, 1)) + Rational(bignum_value).should.eql?(Rational(bignum_value, 1)) end end diff --git a/core/rational/exponent_spec.rb b/core/rational/exponent_spec.rb index 88b4a43796..f8582f0aab 100644 --- a/core/rational/exponent_spec.rb +++ b/core/rational/exponent_spec.rb @@ -2,34 +2,31 @@ describe "Rational#**" do describe "when passed Rational" do - # Guard against the Mathn library - guard -> { !defined?(Math.rsqrt) } do - it "returns Rational(1) if the exponent is Rational(0)" do - (Rational(0) ** Rational(0)).should.eql?(Rational(1)) - (Rational(1) ** Rational(0)).should.eql?(Rational(1)) - (Rational(3, 4) ** Rational(0)).should.eql?(Rational(1)) - (Rational(-1) ** Rational(0)).should.eql?(Rational(1)) - (Rational(-3, 4) ** Rational(0)).should.eql?(Rational(1)) - (Rational(bignum_value) ** Rational(0)).should.eql?(Rational(1)) - (Rational(-bignum_value) ** Rational(0)).should.eql?(Rational(1)) - end + it "returns Rational(1) if the exponent is Rational(0)" do + (Rational(0) ** Rational(0)).should.eql?(Rational(1)) + (Rational(1) ** Rational(0)).should.eql?(Rational(1)) + (Rational(3, 4) ** Rational(0)).should.eql?(Rational(1)) + (Rational(-1) ** Rational(0)).should.eql?(Rational(1)) + (Rational(-3, 4) ** Rational(0)).should.eql?(Rational(1)) + (Rational(bignum_value) ** Rational(0)).should.eql?(Rational(1)) + (Rational(-bignum_value) ** Rational(0)).should.eql?(Rational(1)) + end - it "returns self raised to the argument as a Rational if the exponent's denominator is 1" do - (Rational(3, 4) ** Rational(1, 1)).should.eql?(Rational(3, 4)) - (Rational(3, 4) ** Rational(2, 1)).should.eql?(Rational(9, 16)) - (Rational(3, 4) ** Rational(-1, 1)).should.eql?(Rational(4, 3)) - (Rational(3, 4) ** Rational(-2, 1)).should.eql?(Rational(16, 9)) - end + it "returns self raised to the argument as a Rational if the exponent's denominator is 1" do + (Rational(3, 4) ** Rational(1, 1)).should.eql?(Rational(3, 4)) + (Rational(3, 4) ** Rational(2, 1)).should.eql?(Rational(9, 16)) + (Rational(3, 4) ** Rational(-1, 1)).should.eql?(Rational(4, 3)) + (Rational(3, 4) ** Rational(-2, 1)).should.eql?(Rational(16, 9)) + end - it "returns self raised to the argument as a Float if the exponent's denominator is not 1" do - (Rational(3, 4) ** Rational(4, 3)).should be_close(0.681420222312052, TOLERANCE) - (Rational(3, 4) ** Rational(-4, 3)).should be_close(1.46752322173095, TOLERANCE) - (Rational(3, 4) ** Rational(4, -3)).should be_close(1.46752322173095, TOLERANCE) - end + it "returns self raised to the argument as a Float if the exponent's denominator is not 1" do + (Rational(3, 4) ** Rational(4, 3)).should be_close(0.681420222312052, TOLERANCE) + (Rational(3, 4) ** Rational(-4, 3)).should be_close(1.46752322173095, TOLERANCE) + (Rational(3, 4) ** Rational(4, -3)).should be_close(1.46752322173095, TOLERANCE) + end - it "returns a complex number when self is negative and the passed argument is not 0" do - (Rational(-3, 4) ** Rational(-4, 3)).should be_close(Complex(-0.7337616108654732, 1.2709123906625817), TOLERANCE) - end + it "returns a complex number when self is negative and the passed argument is not 0" do + (Rational(-3, 4) ** Rational(-4, 3)).should be_close(Complex(-0.7337616108654732, 1.2709123906625817), TOLERANCE) end end @@ -46,16 +43,13 @@ (Rational(3, -bignum_value) ** -4).should == Rational(115792089237316195423570985008687907853269984665640564039457584007913129639936, 81) end - # Guard against the Mathn library - guard -> { !defined?(Math.rsqrt) } do - it "returns Rational(1, 1) when the passed argument is 0" do - (Rational(3, 4) ** 0).should.eql?(Rational(1, 1)) - (Rational(-3, 4) ** 0).should.eql?(Rational(1, 1)) - (Rational(3, -4) ** 0).should.eql?(Rational(1, 1)) + it "returns Rational(1, 1) when the passed argument is 0" do + (Rational(3, 4) ** 0).should.eql?(Rational(1, 1)) + (Rational(-3, 4) ** 0).should.eql?(Rational(1, 1)) + (Rational(3, -4) ** 0).should.eql?(Rational(1, 1)) - (Rational(bignum_value, 4) ** 0).should.eql?(Rational(1, 1)) - (Rational(3, -bignum_value) ** 0).should.eql?(Rational(1, 1)) - end + (Rational(bignum_value, 4) ** 0).should.eql?(Rational(1, 1)) + (Rational(3, -bignum_value) ** 0).should.eql?(Rational(1, 1)) end end diff --git a/core/rational/inspect_spec.rb b/core/rational/inspect_spec.rb index edc5cffee9..40eeb7159d 100644 --- a/core/rational/inspect_spec.rb +++ b/core/rational/inspect_spec.rb @@ -6,9 +6,6 @@ Rational(-5, 8).inspect.should == "(-5/8)" Rational(-1, -2).inspect.should == "(1/2)" - # Guard against the Mathn library - guard -> { !defined?(Math.rsqrt) } do - Rational(bignum_value, 1).inspect.should == "(#{bignum_value}/1)" - end + Rational(bignum_value, 1).inspect.should == "(#{bignum_value}/1)" end end diff --git a/core/rational/integer_spec.rb b/core/rational/integer_spec.rb index cd7fa97fcf..443940126a 100644 --- a/core/rational/integer_spec.rb +++ b/core/rational/integer_spec.rb @@ -1,10 +1,7 @@ require_relative "../../spec_helper" describe "Rational#integer?" do - # Guard against the Mathn library - guard -> { !defined?(Math.rsqrt) } do - it "returns false for a rational with a numerator and no denominator" do - Rational(20).integer?.should == false - end + it "returns false for a rational with a numerator and no denominator" do + Rational(20).integer?.should == false end it "returns false for a rational with a numerator and a denominator" do diff --git a/core/rational/round_spec.rb b/core/rational/round_spec.rb index dd6f66f408..2b991aa2ec 100644 --- a/core/rational/round_spec.rb +++ b/core/rational/round_spec.rb @@ -47,11 +47,8 @@ it "returns a Rational" do @rational.round(1).should.is_a?(Rational) @rational.round(2).should.is_a?(Rational) - # Guard against the Mathn library - guard -> { !defined?(Math.rsqrt) } do - Rational(0, 1).round(1).should.is_a?(Rational) - Rational(2, 1).round(1).should.is_a?(Rational) - end + Rational(0, 1).round(1).should.is_a?(Rational) + Rational(2, 1).round(1).should.is_a?(Rational) end it "moves the truncation point n decimal places right" do diff --git a/core/rational/to_s_spec.rb b/core/rational/to_s_spec.rb index 24e30778e5..0720a12218 100644 --- a/core/rational/to_s_spec.rb +++ b/core/rational/to_s_spec.rb @@ -2,11 +2,8 @@ describe "Rational#to_s" do it "returns a string representation of self" do - # Guard against the Mathn library - guard -> { !defined?(Math.rsqrt) } do - Rational(1, 1).to_s.should == "1/1" - Rational(2, 1).to_s.should == "2/1" - end + Rational(1, 1).to_s.should == "1/1" + Rational(2, 1).to_s.should == "2/1" Rational(1, 2).to_s.should == "1/2" Rational(-1, 3).to_s.should == "-1/3" Rational(1, -3).to_s.should == "-1/3" diff --git a/language/precedence_spec.rb b/language/precedence_spec.rb index edb990525e..a4de9fac17 100644 --- a/language/precedence_spec.rb +++ b/language/precedence_spec.rb @@ -131,12 +131,9 @@ class UnaryMinusTest; def -@; 50; end; end it "* / % are left-associative" do (2*1/2).should == (2*1)/2 - # Guard against the Mathn library # TODO: Make these specs not rely on specific behaviour / result values # by using mocks. - guard -> { !defined?(Math.rsqrt) } do - (2*1/2).should_not == 2*(1/2) - end + (2*1/2).should_not == 2*(1/2) (10/7/5).should == (10/7)/5 (10/7/5).should_not == 10/(7/5) diff --git a/library/matrix/divide_spec.rb b/library/matrix/divide_spec.rb index 711a5189e4..d4ffee3c86 100644 --- a/library/matrix/divide_spec.rb +++ b/library/matrix/divide_spec.rb @@ -14,15 +14,12 @@ (@a / @b).should be_close_to_matrix([[2.5, -1.5], [1.5, -0.5]]) end - # Guard against the Mathn library - guard -> { !defined?(Math.rsqrt) } do - it "returns the result of dividing self by a Fixnum" do - (@a / 2).should == Matrix[ [0, 1], [1, 2] ] - end + it "returns the result of dividing self by a Fixnum" do + (@a / 2).should == Matrix[ [0, 1], [1, 2] ] + end - it "returns the result of dividing self by a Bignum" do - (@a / bignum_value).should == Matrix[ [0, 0], [0, 0] ] - end + it "returns the result of dividing self by a Bignum" do + (@a / bignum_value).should == Matrix[ [0, 0], [0, 0] ] end it "returns the result of dividing self by a Float" do diff --git a/library/matrix/real_spec.rb b/library/matrix/real_spec.rb index 4589dc22a5..60872ee64c 100644 --- a/library/matrix/real_spec.rb +++ b/library/matrix/real_spec.rb @@ -16,11 +16,8 @@ Matrix[ [Complex(1,1), 2], [3, 4] ].real?.should == false end - # Guard against the Mathn library - guard -> { !defined?(Math.rsqrt) } do - it "returns false if one element is a Complex whose imaginary part is 0" do - Matrix[ [Complex(1,0), 2], [3, 4] ].real?.should == false - end + it "returns false if one element is a Complex whose imaginary part is 0" do + Matrix[ [Complex(1,0), 2], [3, 4] ].real?.should == false end end From 775485b19700a909bf9bce5351ceeed2935c90e8 Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Sat, 13 Jun 2026 11:09:07 +0200 Subject: [PATCH 2/2] Remove code related to taint/untaint No longer serves any purpose --- core/array/fixtures/classes.rb | 2 +- core/array/pack/a_spec.rb | 3 --- core/array/pack/b_spec.rb | 3 --- core/array/pack/h_spec.rb | 3 --- core/array/pack/m_spec.rb | 3 --- core/array/pack/p_spec.rb | 3 --- core/array/pack/shared/taint.rb | 2 -- core/array/pack/u_spec.rb | 2 -- core/array/pack/z_spec.rb | 2 -- core/string/fixtures/classes.rb | 2 +- core/string/unpack/a_spec.rb | 3 --- core/string/unpack/b_spec.rb | 3 --- core/string/unpack/h_spec.rb | 3 --- core/string/unpack/m_spec.rb | 3 --- core/string/unpack/p_spec.rb | 3 --- core/string/unpack/shared/taint.rb | 2 -- core/string/unpack/u_spec.rb | 3 --- core/string/unpack/z_spec.rb | 2 -- library/delegate/delegator/taint_spec.rb | 8 -------- library/delegate/delegator/trust_spec.rb | 8 -------- library/delegate/delegator/untaint_spec.rb | 8 -------- library/delegate/delegator/untrust_spec.rb | 8 -------- optional/capi/ext/rbasic_spec.c | 5 ----- optional/capi/object_spec.rb | 12 ------------ security/cve_2018_16396_spec.rb | 7 ------- 25 files changed, 2 insertions(+), 101 deletions(-) delete mode 100644 core/array/pack/shared/taint.rb delete mode 100644 core/string/unpack/shared/taint.rb delete mode 100644 library/delegate/delegator/taint_spec.rb delete mode 100644 library/delegate/delegator/trust_spec.rb delete mode 100644 library/delegate/delegator/untaint_spec.rb delete mode 100644 library/delegate/delegator/untrust_spec.rb delete mode 100644 security/cve_2018_16396_spec.rb diff --git a/core/array/fixtures/classes.rb b/core/array/fixtures/classes.rb index 05283c0f74..7389cb9855 100644 --- a/core/array/fixtures/classes.rb +++ b/core/array/fixtures/classes.rb @@ -5,7 +5,7 @@ def pack_format(count=nil, repeat=nil) format = instance_variable_get(:@method) format += count.to_s unless format == 'P' || format == 'p' format *= repeat if repeat - format.dup # because it may then become tainted + format end end diff --git a/core/array/pack/a_spec.rb b/core/array/pack/a_spec.rb index 03bfd8214c..491b8af9c2 100644 --- a/core/array/pack/a_spec.rb +++ b/core/array/pack/a_spec.rb @@ -3,14 +3,12 @@ require_relative '../fixtures/classes' require_relative 'shared/basic' require_relative 'shared/string' -require_relative 'shared/taint' describe "Array#pack with format 'A'" do it_behaves_like :array_pack_basic, 'A' it_behaves_like :array_pack_basic_non_float, 'A' it_behaves_like :array_pack_no_platform, 'A' it_behaves_like :array_pack_string, 'A' - it_behaves_like :array_pack_taint, 'A' it "calls #to_str to convert an Object to a String" do obj = mock("pack A string") @@ -49,7 +47,6 @@ it_behaves_like :array_pack_basic_non_float, 'a' it_behaves_like :array_pack_no_platform, 'a' it_behaves_like :array_pack_string, 'a' - it_behaves_like :array_pack_taint, 'a' it "adds all the bytes to the output when passed the '*' modifier" do ["abc"].pack("a*").should == "abc" diff --git a/core/array/pack/b_spec.rb b/core/array/pack/b_spec.rb index f7576846ef..ab50bd5af8 100644 --- a/core/array/pack/b_spec.rb +++ b/core/array/pack/b_spec.rb @@ -3,14 +3,12 @@ require_relative '../fixtures/classes' require_relative 'shared/basic' require_relative 'shared/encodings' -require_relative 'shared/taint' describe "Array#pack with format 'B'" do it_behaves_like :array_pack_basic, 'B' it_behaves_like :array_pack_basic_non_float, 'B' it_behaves_like :array_pack_arguments, 'B' it_behaves_like :array_pack_hex, 'B' - it_behaves_like :array_pack_taint, 'B' it "calls #to_str to convert an Object to a String" do obj = mock("pack B string") @@ -66,7 +64,6 @@ it_behaves_like :array_pack_basic_non_float, 'b' it_behaves_like :array_pack_arguments, 'b' it_behaves_like :array_pack_hex, 'b' - it_behaves_like :array_pack_taint, 'b' it "calls #to_str to convert an Object to a String" do obj = mock("pack H string") diff --git a/core/array/pack/h_spec.rb b/core/array/pack/h_spec.rb index 1492d02b1f..389295cb0b 100644 --- a/core/array/pack/h_spec.rb +++ b/core/array/pack/h_spec.rb @@ -3,14 +3,12 @@ require_relative '../fixtures/classes' require_relative 'shared/basic' require_relative 'shared/encodings' -require_relative 'shared/taint' describe "Array#pack with format 'H'" do it_behaves_like :array_pack_basic, 'H' it_behaves_like :array_pack_basic_non_float, 'H' it_behaves_like :array_pack_arguments, 'H' it_behaves_like :array_pack_hex, 'H' - it_behaves_like :array_pack_taint, 'H' it "calls #to_str to convert an Object to a String" do obj = mock("pack H string") @@ -112,7 +110,6 @@ it_behaves_like :array_pack_basic_non_float, 'h' it_behaves_like :array_pack_arguments, 'h' it_behaves_like :array_pack_hex, 'h' - it_behaves_like :array_pack_taint, 'h' it "calls #to_str to convert an Object to a String" do obj = mock("pack H string") diff --git a/core/array/pack/m_spec.rb b/core/array/pack/m_spec.rb index fb670d120e..090ae6a702 100644 --- a/core/array/pack/m_spec.rb +++ b/core/array/pack/m_spec.rb @@ -2,13 +2,11 @@ require_relative '../../../spec_helper' require_relative '../fixtures/classes' require_relative 'shared/basic' -require_relative 'shared/taint' describe "Array#pack with format 'M'" do it_behaves_like :array_pack_basic, 'M' it_behaves_like :array_pack_basic_non_float, 'M' it_behaves_like :array_pack_arguments, 'M' - it_behaves_like :array_pack_taint, 'M' it "encodes an empty string as an empty string" do [""].pack("M").should == "" @@ -202,7 +200,6 @@ it_behaves_like :array_pack_basic, 'm' it_behaves_like :array_pack_basic_non_float, 'm' it_behaves_like :array_pack_arguments, 'm' - it_behaves_like :array_pack_taint, 'm' it "encodes an empty string as an empty string" do [""].pack("m").should == "" diff --git a/core/array/pack/p_spec.rb b/core/array/pack/p_spec.rb index b023bf9110..c9ca5f7174 100644 --- a/core/array/pack/p_spec.rb +++ b/core/array/pack/p_spec.rb @@ -1,11 +1,9 @@ require_relative '../../../spec_helper' require_relative '../fixtures/classes' require_relative 'shared/basic' -require_relative 'shared/taint' describe "Array#pack with format 'P'" do it_behaves_like :array_pack_basic_non_float, 'P' - it_behaves_like :array_pack_taint, 'P' it "produces as many bytes as there are in a pointer" do ["hello"].pack("P").size.should == [0].pack("J").size @@ -22,7 +20,6 @@ describe "Array#pack with format 'p'" do it_behaves_like :array_pack_basic_non_float, 'p' - it_behaves_like :array_pack_taint, 'p' it "produces as many bytes as there are in a pointer" do ["hello"].pack("p").size.should == [0].pack("J").size diff --git a/core/array/pack/shared/taint.rb b/core/array/pack/shared/taint.rb deleted file mode 100644 index 2c2b011c34..0000000000 --- a/core/array/pack/shared/taint.rb +++ /dev/null @@ -1,2 +0,0 @@ -describe :array_pack_taint, shared: true do -end diff --git a/core/array/pack/u_spec.rb b/core/array/pack/u_spec.rb index c6a0d77eb2..633410404d 100644 --- a/core/array/pack/u_spec.rb +++ b/core/array/pack/u_spec.rb @@ -3,7 +3,6 @@ require_relative '../fixtures/classes' require_relative 'shared/basic' require_relative 'shared/unicode' -require_relative 'shared/taint' describe "Array#pack with format 'U'" do it_behaves_like :array_pack_basic, 'U' @@ -16,7 +15,6 @@ it_behaves_like :array_pack_basic, 'u' it_behaves_like :array_pack_basic_non_float, 'u' it_behaves_like :array_pack_arguments, 'u' - it_behaves_like :array_pack_taint, 'u' it "calls #to_str to convert an Object to a String" do obj = mock("pack u string") diff --git a/core/array/pack/z_spec.rb b/core/array/pack/z_spec.rb index 5cd084c825..8df5c42bef 100644 --- a/core/array/pack/z_spec.rb +++ b/core/array/pack/z_spec.rb @@ -3,14 +3,12 @@ require_relative '../fixtures/classes' require_relative 'shared/basic' require_relative 'shared/string' -require_relative 'shared/taint' describe "Array#pack with format 'Z'" do it_behaves_like :array_pack_basic, 'Z' it_behaves_like :array_pack_basic_non_float, 'Z' it_behaves_like :array_pack_no_platform, 'Z' it_behaves_like :array_pack_string, 'Z' - it_behaves_like :array_pack_taint, 'Z' it "calls #to_str to convert an Object to a String" do obj = mock("pack Z string") diff --git a/core/string/fixtures/classes.rb b/core/string/fixtures/classes.rb index 26fcd51b5d..edc8f3ee3e 100644 --- a/core/string/fixtures/classes.rb +++ b/core/string/fixtures/classes.rb @@ -4,7 +4,7 @@ class Object def unpack_format(count=nil, repeat=nil) format = "#{instance_variable_get(:@method)}#{count}" format *= repeat if repeat - format.dup # because it may then become tainted + format end end diff --git a/core/string/unpack/a_spec.rb b/core/string/unpack/a_spec.rb index a68e842e15..925962fddb 100644 --- a/core/string/unpack/a_spec.rb +++ b/core/string/unpack/a_spec.rb @@ -3,14 +3,12 @@ require_relative '../fixtures/classes' require_relative 'shared/basic' require_relative 'shared/string' -require_relative 'shared/taint' describe "String#unpack with format 'A'" do it_behaves_like :string_unpack_basic, 'A' it_behaves_like :string_unpack_no_platform, 'A' it_behaves_like :string_unpack_string, 'A' it_behaves_like :string_unpack_Aa, 'A' - it_behaves_like :string_unpack_taint, 'A' it "removes trailing space and NULL bytes from the decoded string" do [ ["a\x00 b \x00", ["a\x00 b", ""]], @@ -42,7 +40,6 @@ it_behaves_like :string_unpack_no_platform, 'a' it_behaves_like :string_unpack_string, 'a' it_behaves_like :string_unpack_Aa, 'a' - it_behaves_like :string_unpack_taint, 'a' it "does not remove trailing whitespace or NULL bytes from the decoded string" do [ ["a\x00 b \x00", ["a\x00 b \x00"]], diff --git a/core/string/unpack/b_spec.rb b/core/string/unpack/b_spec.rb index fac6ef5151..79ee6163e5 100644 --- a/core/string/unpack/b_spec.rb +++ b/core/string/unpack/b_spec.rb @@ -2,12 +2,10 @@ require_relative '../../../spec_helper' require_relative '../fixtures/classes' require_relative 'shared/basic' -require_relative 'shared/taint' describe "String#unpack with format 'B'" do it_behaves_like :string_unpack_basic, 'B' it_behaves_like :string_unpack_no_platform, 'B' - it_behaves_like :string_unpack_taint, 'B' it "decodes one bit from each byte for each format character starting with the most significant bit" do [ ["\x00", "B", ["0"]], @@ -105,7 +103,6 @@ describe "String#unpack with format 'b'" do it_behaves_like :string_unpack_basic, 'b' it_behaves_like :string_unpack_no_platform, 'b' - it_behaves_like :string_unpack_taint, 'b' it "decodes one bit from each byte for each format character starting with the least significant bit" do [ ["\x00", "b", ["0"]], diff --git a/core/string/unpack/h_spec.rb b/core/string/unpack/h_spec.rb index 0cf8d943a7..b8f7d9ca31 100644 --- a/core/string/unpack/h_spec.rb +++ b/core/string/unpack/h_spec.rb @@ -2,12 +2,10 @@ require_relative '../../../spec_helper' require_relative '../fixtures/classes' require_relative 'shared/basic' -require_relative 'shared/taint' describe "String#unpack with format 'H'" do it_behaves_like :string_unpack_basic, 'H' it_behaves_like :string_unpack_no_platform, 'H' - it_behaves_like :string_unpack_taint, 'H' it "decodes one nibble from each byte for each format character starting with the most significant bit" do [ ["\x8f", "H", ["8"]], @@ -74,7 +72,6 @@ describe "String#unpack with format 'h'" do it_behaves_like :string_unpack_basic, 'h' it_behaves_like :string_unpack_no_platform, 'h' - it_behaves_like :string_unpack_taint, 'h' it "decodes one nibble from each byte for each format character starting with the least significant bit" do [ ["\x8f", "h", ["f"]], diff --git a/core/string/unpack/m_spec.rb b/core/string/unpack/m_spec.rb index c1c1eea629..e4b26c764d 100644 --- a/core/string/unpack/m_spec.rb +++ b/core/string/unpack/m_spec.rb @@ -2,12 +2,10 @@ require_relative '../../../spec_helper' require_relative '../fixtures/classes' require_relative 'shared/basic' -require_relative 'shared/taint' describe "String#unpack with format 'M'" do it_behaves_like :string_unpack_basic, 'M' it_behaves_like :string_unpack_no_platform, 'M' - it_behaves_like :string_unpack_taint, 'M' it "decodes an empty string" do "".unpack("M").should == [""] @@ -107,7 +105,6 @@ describe "String#unpack with format 'm'" do it_behaves_like :string_unpack_basic, 'm' it_behaves_like :string_unpack_no_platform, 'm' - it_behaves_like :string_unpack_taint, 'm' it "decodes an empty string" do "".unpack("m").should == [""] diff --git a/core/string/unpack/p_spec.rb b/core/string/unpack/p_spec.rb index 4103730269..98e10df6bb 100644 --- a/core/string/unpack/p_spec.rb +++ b/core/string/unpack/p_spec.rb @@ -1,11 +1,9 @@ require_relative '../../../spec_helper' require_relative '../fixtures/classes' require_relative 'shared/basic' -require_relative 'shared/taint' describe "String#unpack with format 'P'" do it_behaves_like :string_unpack_basic, 'P' - it_behaves_like :string_unpack_taint, 'P' it "round-trips a string through pack and unpack" do ["hello"].pack("P").unpack("P5").should == ["hello"] @@ -29,7 +27,6 @@ describe "String#unpack with format 'p'" do it_behaves_like :string_unpack_basic, 'p' - it_behaves_like :string_unpack_taint, 'p' it "round-trips a string through pack and unpack" do ["hello"].pack("p").unpack("p").should == ["hello"] diff --git a/core/string/unpack/shared/taint.rb b/core/string/unpack/shared/taint.rb deleted file mode 100644 index 79c7251f01..0000000000 --- a/core/string/unpack/shared/taint.rb +++ /dev/null @@ -1,2 +0,0 @@ -describe :string_unpack_taint, shared: true do -end diff --git a/core/string/unpack/u_spec.rb b/core/string/unpack/u_spec.rb index 720c1b8583..d620b70b71 100644 --- a/core/string/unpack/u_spec.rb +++ b/core/string/unpack/u_spec.rb @@ -3,13 +3,11 @@ require_relative '../fixtures/classes' require_relative 'shared/basic' require_relative 'shared/unicode' -require_relative 'shared/taint' describe "String#unpack with format 'U'" do it_behaves_like :string_unpack_basic, 'U' it_behaves_like :string_unpack_no_platform, 'U' it_behaves_like :string_unpack_unicode, 'U' - it_behaves_like :string_unpack_taint, 'U' it "raises ArgumentError on a malformed byte sequence" do -> { "\xE3".unpack('U') }.should.raise(ArgumentError) @@ -23,7 +21,6 @@ describe "String#unpack with format 'u'" do it_behaves_like :string_unpack_basic, 'u' it_behaves_like :string_unpack_no_platform, 'u' - it_behaves_like :string_unpack_taint, 'u' it "decodes an empty string as an empty string" do "".unpack("u").should == [""] diff --git a/core/string/unpack/z_spec.rb b/core/string/unpack/z_spec.rb index 1030390550..7d24687b2d 100644 --- a/core/string/unpack/z_spec.rb +++ b/core/string/unpack/z_spec.rb @@ -3,13 +3,11 @@ require_relative '../fixtures/classes' require_relative 'shared/basic' require_relative 'shared/string' -require_relative 'shared/taint' describe "String#unpack with format 'Z'" do it_behaves_like :string_unpack_basic, 'Z' it_behaves_like :string_unpack_no_platform, 'Z' it_behaves_like :string_unpack_string, 'Z' - it_behaves_like :string_unpack_taint, 'Z' it "stops decoding at NULL bytes when passed the '*' modifier" do "a\x00\x00 b \x00c".unpack('Z*Z*Z*Z*').should == ["a", "", " b ", "c"] diff --git a/library/delegate/delegator/taint_spec.rb b/library/delegate/delegator/taint_spec.rb deleted file mode 100644 index 6bf13bb73d..0000000000 --- a/library/delegate/delegator/taint_spec.rb +++ /dev/null @@ -1,8 +0,0 @@ -require_relative '../../../spec_helper' -require_relative '../fixtures/classes' - -describe "Delegator#taint" do - before :each do - @delegate = DelegateSpecs::Delegator.new("") - end -end diff --git a/library/delegate/delegator/trust_spec.rb b/library/delegate/delegator/trust_spec.rb deleted file mode 100644 index f1b81814c5..0000000000 --- a/library/delegate/delegator/trust_spec.rb +++ /dev/null @@ -1,8 +0,0 @@ -require_relative '../../../spec_helper' -require_relative '../fixtures/classes' - -describe "Delegator#trust" do - before :each do - @delegate = DelegateSpecs::Delegator.new([]) - end -end diff --git a/library/delegate/delegator/untaint_spec.rb b/library/delegate/delegator/untaint_spec.rb deleted file mode 100644 index 4051fd2629..0000000000 --- a/library/delegate/delegator/untaint_spec.rb +++ /dev/null @@ -1,8 +0,0 @@ -require_relative '../../../spec_helper' -require_relative '../fixtures/classes' - -describe "Delegator#untaint" do - before :each do - @delegate = -> { DelegateSpecs::Delegator.new("") }.call - end -end diff --git a/library/delegate/delegator/untrust_spec.rb b/library/delegate/delegator/untrust_spec.rb deleted file mode 100644 index 4f7fa1e582..0000000000 --- a/library/delegate/delegator/untrust_spec.rb +++ /dev/null @@ -1,8 +0,0 @@ -require_relative '../../../spec_helper' -require_relative '../fixtures/classes' - -describe "Delegator#untrust" do - before :each do - @delegate = DelegateSpecs::Delegator.new("") - end -end diff --git a/optional/capi/ext/rbasic_spec.c b/optional/capi/ext/rbasic_spec.c index 5a95b92804..892d3258c0 100644 --- a/optional/capi/ext/rbasic_spec.c +++ b/optional/capi/ext/rbasic_spec.c @@ -13,13 +13,8 @@ extern "C" { #define RBASIC_SET_FLAGS(obj, flags_to_set) (RBASIC(obj)->flags = flags_to_set) #endif -#ifndef FL_SHAREABLE -static const VALUE VISIBLE_BITS = FL_TAINT | FL_FREEZE; -static const VALUE DATA_VISIBLE_BITS = FL_TAINT | FL_FREEZE | ~(FL_USER0 - 1); -#else static const VALUE VISIBLE_BITS = FL_FREEZE; static const VALUE DATA_VISIBLE_BITS = FL_FREEZE | ~(FL_USER0 - 1); -#endif #if SIZEOF_VALUE == SIZEOF_LONG #define VALUE2NUM(v) ULONG2NUM(v) diff --git a/optional/capi/object_spec.rb b/optional/capi/object_spec.rb index 8e907a5a8c..298aad3891 100644 --- a/optional/capi/object_spec.rb +++ b/optional/capi/object_spec.rb @@ -652,15 +652,6 @@ def reach end end - describe "OBJ_TAINT" do - end - - describe "OBJ_TAINTED" do - end - - describe "OBJ_INFECT" do - end - describe "rb_obj_freeze" do it "freezes the object passed to it" do obj = "" @@ -701,9 +692,6 @@ def reach end end - describe "rb_obj_taint" do - end - describe "rb_check_frozen" do it "raises a FrozenError if the obj is frozen" do -> { @o.rb_check_frozen("".freeze) }.should.raise(FrozenError) diff --git a/security/cve_2018_16396_spec.rb b/security/cve_2018_16396_spec.rb deleted file mode 100644 index 6f8a5d2f5d..0000000000 --- a/security/cve_2018_16396_spec.rb +++ /dev/null @@ -1,7 +0,0 @@ -require_relative '../spec_helper' - -describe "Array#pack" do -end - -describe "String#unpack" do -end