aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
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..6d283dd145 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_TEST_RAW(str, RSTRING_FSTR) && FL_ABLE(obj))
+ /* fstring must not be tainted, at least */
+ OBJ_INFECT_RAW(str, obj);
return str;
}