Skip to content

Commit

Permalink
merge revision(s) 63252: [Backport #14707]
Browse files Browse the repository at this point in the history
	string.c: fix scanned substring with `\K`

	* string.c (scan_once): fix the matched substring with `\K`, the
	  beginning of that string may differ from the matched position.
	  [ruby-core:86663] [Bug #14707]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@64320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nagachika committed Aug 12, 2018
1 parent 78e4b57 commit fa07823
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions string.c
Original file line number Diff line number Diff line change
Expand Up @@ -8950,6 +8950,7 @@ scan_once(VALUE str, VALUE pat, long *start, int set_backref_str)
else {
match = rb_backref_get();
regs = RMATCH_REGS(match);
pos = BEG(0);
end = END(0);
}
if (pos == end) {
Expand Down
2 changes: 2 additions & 0 deletions test/ruby/test_string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1537,6 +1537,8 @@ def test_scan
assert_nil($~)

assert_equal(3, S("hello hello hello").scan("hello".taint).count(&:tainted?))

assert_equal(%w[1 2 3], S("a1 a2 a3").scan(/a\K./))
end

def test_size
Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.5.2"
#define RUBY_RELEASE_DATE "2018-08-12"
#define RUBY_PATCHLEVEL 67
#define RUBY_PATCHLEVEL 68

#define RUBY_RELEASE_YEAR 2018
#define RUBY_RELEASE_MONTH 8
Expand Down

0 comments on commit fa07823

Please sign in to comment.