summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-28 12:25:45 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-28 12:25:45 +0000
commit340cd503a7d0f73bb1ca6446f78793f968a5d5bf (patch)
tree6ef0adfb397248308136bd096c7dc3241b782809 /marshal.c
parent4c766e1713eda038b5118e1ebfbb6e26545966cd (diff)
* include/ruby/ruby.h (struct RRegexp): new field usecnt. replace
str and len by src. * gc.c (gc_mark_children): mark src field of regexp. (obj_free): don't free str field. * re.c (REG_BUSY): removed. (rb_reg_initialize): prohibit re-initialize regexp. (rb_reg_search): use usecnt to prevent freeing regexp currently using. this prevents SEGV by: r = /\A((a.)*(a.)*)*b/ r =~ "ab" + "\xc2\xa1".force_encoding("euc-jp") t = Thread.new { r =~ "ab"*8 + "\xc2\xa1".force_encoding("utf-8")} sleep 0.2 r =~ "ab"*8 + "\xc2\xa1".force_encoding("euc-jp") git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/marshal.c b/marshal.c
index c9170c6f37..f2d01809ca 100644
--- a/marshal.c
+++ b/marshal.c
@@ -693,10 +693,13 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
break;
case T_REGEXP:
- w_uclass(obj, rb_cRegexp, arg);
- w_byte(TYPE_REGEXP, arg);
- w_bytes(RREGEXP(obj)->str, RREGEXP(obj)->len, arg);
- w_byte((char)rb_reg_options(obj), arg);
+ w_uclass(obj, rb_cRegexp, arg);
+ w_byte(TYPE_REGEXP, arg);
+ {
+ int opts = rb_reg_options(obj);
+ w_bytes(RREGEXP_SRC_PTR(obj), RREGEXP_SRC_LEN(obj), arg);
+ w_byte((char)opts, arg);
+ }
break;
case T_ARRAY: