summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-29 09:58:48 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-29 09:58:48 (GMT)
commit316210b80bd0afff27be5925dbf5521982bebe93 (patch)
treea061a97dbcc5ab2923f16cc7d351cb9b05fa8a18 /re.c
parentd1e65737f65b984ca4d3970d0fe984745db80554 (diff)
re.c: append excape sequence as-is
* re.c (unescape_nonascii): append excape sequence as-is not unescaped character, to get rid of unexpected meta-character. [ruby-core:67193] [Bug #10670] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/re.c b/re.c
index 1a0f0b1..1f88d60 100644
--- a/re.c
+++ b/re.c
@@ -2298,9 +2298,10 @@ unescape_nonascii(const char *p, const char *end, rb_encoding *enc,
case 'M': /* \M-X, \M-\C-X, \M-\cX */
p = p-2;
if (enc == rb_usascii_encoding()) {
+ const char *pbeg = p;
c = read_escaped_byte(&p, end, err);
if (c == (char)-1) return -1;
- rb_str_buf_cat(buf, &c, 1);
+ rb_str_buf_cat(buf, pbeg, p-pbeg);
}
else {
if (unescape_escaped_nonascii(&p, end, enc, buf, encp, err) != 0)