summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-29 09:24:37 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-29 09:24:37 +0000
commit183bbd8b69077ff98c2c39f5ebc61ffe60725786 (patch)
treec15b113cf3c9066b19cb2ee0f2ad3d80785b571c
parent89f9c4144ff1ea07f3ca977e6a7336b01473e383 (diff)
Sorry, commit miss of r30412.
* re.c (rb_reg_expr_str): need to escape if the coderage is invalid. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--re.c5
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c400fdb1d2..1c767078bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Dec 29 18:23:46 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * re.c (rb_reg_expr_str): need to escape if the coderage is invalid.
+
Wed Dec 29 10:06:51 2010 Tanaka Akira <akr@fsij.org>
* signal.c: parenthesize macro arguments.
@@ -12,8 +16,6 @@ Wed Dec 29 07:07:06 2010 Eric Hodel <drbrain@segment7.net>
Tue Dec 28 18:36:38 2010 NAKAMURA Usaku <usa@ruby-lang.org>
- * re.c (rb_reg_expr_str): need to escape if the coderage is invalid.
-
* error.c, include/ruby/intern.h (rb_compile_error_with_enc): new
function to raise syntax error, with source encoding'ed message.
diff --git a/re.c b/re.c
index 047acb62f9..2157ee8764 100644
--- a/re.c
+++ b/re.c
@@ -321,11 +321,14 @@ rb_reg_expr_str(VALUE str, const char *s, long len,
rb_encoding *enc, rb_encoding *resenc)
{
const char *p, *pend;
+ int cr = ENC_CODERANGE_UNKNOWN;
int need_escape = 0;
int c, clen;
p = s; pend = p + len;
- if (rb_enc_asciicompat(enc)) {
+ rb_str_coderange_scan_restartable(p, pend, enc, &cr);
+ if (rb_enc_asciicompat(enc) &&
+ (cr == ENC_CODERANGE_VALID || cr == ENC_CODERANGE_7BIT)) {
while (p < pend) {
c = rb_enc_ascget(p, pend, &clen, enc);
if (c == -1) {