ruby-cvs:24858
From: akr ruby-lang.org
Date: Sat, 28 Jun 2008 21:25:47 +0900 (JST)
Subject: [ruby-cvs:24858] Ruby:r17635 (trunk): * include/ruby/ruby.h (struct RRegexp): new field usecnt. replace
akr 2008-06-28 21:25:45 +0900 (Sat, 28 Jun 2008)
New Revision: 17635
Modified files:
trunk/ChangeLog
trunk/gc.c
trunk/include/ruby/ruby.h
trunk/marshal.c
trunk/re.c
trunk/string.c
Log:
* 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")
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/ruby.h?r1=17635&r2=17634&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=17635&r2=17634&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17635&r2=17634&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/gc.c?r1=17635&r2=17634&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/marshal.c?r1=17635&r2=17634&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/re.c?r1=17635&r2=17634&diff_format=u