aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-12 02:38:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-12 02:38:53 +0000
commit3507e2c2e53779fdd385fb08015c455658183114 (patch)
tree8b333101890a77714eaa19ea702c90977f41f43b /re.c
parent4d950bb16ef600e7c4e6c510c598df6ebc104ce2 (diff)
downloadruby-3507e2c2e53779fdd385fb08015c455658183114.tar.gz
re.c: char boundary
* re.c (rb_reg_match_m_p): consider char boundary. rb_str_subpos does not adjust to the boundary if len == 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/re.c b/re.c
index 2d786f5cef..95ba903480 100644
--- a/re.c
+++ b/re.c
@@ -3243,8 +3243,8 @@ rb_reg_match_m_p(int argc, VALUE *argv, VALUE re)
if (pos < 0) return Qfalse;
}
if (pos > 0) {
- long len = 0;
- char *beg = rb_str_subpos(str, pos, &len);
+ long len = 1;
+ const char *beg = rb_str_subpos(str, pos, &len);
if (!beg) return Qfalse;
pos = beg - RSTRING_PTR(str);
}