From 1dcbd6921e21e7188dc24cdf37c9b5c07269c062 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 8 Apr 2008 01:53:35 +0000 Subject: * re.c (rb_reg_quote): should always copy the quoting string. [ruby-core:16235] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 3 +++ re.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 61494b675c..b14a0e1abc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ Tue Apr 8 10:34:10 2008 Yukihiro Matsumoto * load.c (rb_require_safe): should check fname path after $SAFE is properly set. [ruby-dev:34268] + * re.c (rb_reg_quote): should always copy the quoting string. + [ruby-core:16235] + Tue Apr 8 10:30:29 2008 Nobuyoshi Nakada * common.mk (prelude.c): depends on enc/prelude.rb. diff --git a/re.c b/re.c index 3f115cd04b..f0776a1fe8 100644 --- a/re.c +++ b/re.c @@ -2759,11 +2759,11 @@ rb_reg_quote(VALUE str) } s += clen; } + tmp = rb_str_new3(str); if (ascii_only) { - str = rb_str_new3(str); - rb_enc_associate(str, rb_usascii_encoding()); + rb_enc_associate(tmp, rb_usascii_encoding()); } - return str; + return tmp; meta_found: tmp = rb_str_new(0, RSTRING_LEN(str)*2); -- cgit v1.2.3