aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-03 07:02:19 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-03 07:02:19 +0000
commitb887c7c20ab81b50ed7cb8c7db3218c443985d6b (patch)
tree031095aca3d134a7739d0aee6638990570687884 /string.c
parente2977fc8f36cc25008011698b03fe7b012077101 (diff)
downloadruby-b887c7c20ab81b50ed7cb8c7db3218c443985d6b.tar.gz
string.c: should not taint fstring
* string.c (rb_obj_as_string): fstring should not be infected. TODO: other frozen strings also may not be. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/string.c b/string.c
index d1a051b6dd..4cb62375da 100644
--- a/string.c
+++ b/string.c
@@ -1247,7 +1247,9 @@ rb_obj_as_string(VALUE obj)
str = rb_funcall(obj, idTo_s, 0);
if (!RB_TYPE_P(str, T_STRING))
return rb_any_to_s(obj);
- OBJ_INFECT(str, obj);
+ if (!FL_SET(str, RSTRING_FSTR) && FL_ABLE(obj))
+ /* fstring must not be tainted, at least */
+ OBJ_INFECT_RAW(str, obj);
return str;
}