summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--eval.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ac7b8059c8..bd9cf125cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sat Feb 28 18:05:58 2009 Nobuyoshi Nakada <[email protected]>
+
+ * eval.c (rb_eval): needs to guard intermediate string objects.
+ based on a patch from Brent Roman <brent AT mbari.org> a
+ [ruby-core:22584].
+
Fri Feb 27 17:45:25 2009 Nobuyoshi Nakada <[email protected]>
* file.c (file_load_ok): checks if regular file, except for the
diff --git a/eval.c b/eval.c
index a06974657f..cf62314230 100644
--- a/eval.c
+++ b/eval.c
@@ -3934,11 +3934,13 @@ rb_eval(self, n)
case NODE_DREGX:
result = rb_reg_new(RSTRING(str)->ptr, RSTRING(str)->len,
node->nd_cflag);
+ RB_GC_GUARD(str); /* ensure str is not GC'd in rb_reg_new */
break;
case NODE_DREGX_ONCE: /* regexp expand once */
result = rb_reg_new(RSTRING(str)->ptr, RSTRING(str)->len,
node->nd_cflag);
nd_set_type(node, NODE_LIT);
+ RB_GC_GUARD(str); /* ensure str is not GC'd in rb_reg_new */
node->nd_lit = result;
break;
case NODE_LIT: