summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/re.c b/re.c
index d6f860b..91d920b 100644
--- a/re.c
+++ b/re.c
@@ -649,6 +649,13 @@ rb_reg_search(re, str, pos, reverse)
if (NIL_P(match) || FL_TEST(match, MATCH_BUSY)) {
match = match_alloc();
}
+ else {
+ if (rb_safe_level() >= 3)
+ OBJ_TAINT(match);
+ else
+ FL_UNSET(match, FL_TAINT);
+ }
+
re_copy_registers(RMATCH(match)->regs, &regs);
RMATCH(match)->str = rb_str_new4(str);
rb_backref_set(match);