merge revision(s) 52868: [Backport #11767]

* range.c (range_to_s): should be infected by the receiver.
	  str2 infects by appending.  [ruby-core:71811] [Bug #11767]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@52875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2015-12-04 01:56:19 +00:00
parent 1745d2584a
commit 0399a3d47b
4 changed files with 20 additions and 5 deletions

View file

@ -1,3 +1,8 @@
Fri Dec 4 10:55:08 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* range.c (range_to_s): should be infected by the receiver.
str2 infects by appending. [ruby-core:71811] [Bug #11767]
Wed Dec 2 15:14:29 2015 NARUSE, Yui <naruse@ruby-lang.org> Wed Dec 2 15:14:29 2015 NARUSE, Yui <naruse@ruby-lang.org>
* ext/readline/extconf.rb: call dir_config("libedit") * ext/readline/extconf.rb: call dir_config("libedit")

View file

@ -1078,7 +1078,7 @@ range_to_s(VALUE range)
str = rb_str_dup(str); str = rb_str_dup(str);
rb_str_cat(str, "...", EXCL(range) ? 3 : 2); rb_str_cat(str, "...", EXCL(range) ? 3 : 2);
rb_str_append(str, str2); rb_str_append(str, str2);
OBJ_INFECT(str, str2); OBJ_INFECT(str, range);
return str; return str;
} }
@ -1096,7 +1096,7 @@ inspect_range(VALUE range, VALUE dummy, int recur)
str = rb_str_dup(str); str = rb_str_dup(str);
rb_str_cat(str, "...", EXCL(range) ? 3 : 2); rb_str_cat(str, "...", EXCL(range) ? 3 : 2);
rb_str_append(str, str2); rb_str_append(str, str2);
OBJ_INFECT(str, str2); OBJ_INFECT(str, range);
return str; return str;
} }

View file

@ -266,11 +266,21 @@ class TestRange < Test::Unit::TestCase
def test_to_s def test_to_s
assert_equal("0..1", (0..1).to_s) assert_equal("0..1", (0..1).to_s)
assert_equal("0...1", (0...1).to_s) assert_equal("0...1", (0...1).to_s)
bug11767 = '[ruby-core:71811] [Bug #11767]'
assert_predicate(("0".taint.."1").to_s, :tainted?, bug11767)
assert_predicate(("0".."1".taint).to_s, :tainted?, bug11767)
assert_predicate(("0".."1").taint.to_s, :tainted?, bug11767)
end end
def test_inspect def test_inspect
assert_equal("0..1", (0..1).inspect) assert_equal("0..1", (0..1).inspect)
assert_equal("0...1", (0...1).inspect) assert_equal("0...1", (0...1).inspect)
bug11767 = '[ruby-core:71811] [Bug #11767]'
assert_predicate(("0".taint.."1").inspect, :tainted?, bug11767)
assert_predicate(("0".."1".taint).inspect, :tainted?, bug11767)
assert_predicate(("0".."1").taint.inspect, :tainted?, bug11767)
end end
def test_eqq def test_eqq

View file

@ -1,10 +1,10 @@
#define RUBY_VERSION "2.1.8" #define RUBY_VERSION "2.1.8"
#define RUBY_RELEASE_DATE "2015-12-02" #define RUBY_RELEASE_DATE "2015-12-04"
#define RUBY_PATCHLEVEL 431 #define RUBY_PATCHLEVEL 432
#define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_YEAR 2015
#define RUBY_RELEASE_MONTH 12 #define RUBY_RELEASE_MONTH 12
#define RUBY_RELEASE_DAY 2 #define RUBY_RELEASE_DAY 4
#include "ruby/version.h" #include "ruby/version.h"