diff options
| author | nagachika <nagachika@ruby-lang.org> | 2023-07-17 14:20:00 +0900 |
|---|---|---|
| committer | nagachika <nagachika@ruby-lang.org> | 2023-07-17 14:20:00 +0900 |
| commit | a7b0d3c9db9afeccf6e0962bb1cdcbea5bf04cae (patch) | |
| tree | 9033bfc1113b904e02f394b508ccda9002651b5e | |
| parent | 0c5d539421e50351ed26fbf9cac852d58425776a (diff) | |
merge revision(s) 0ac3f2c20e50c22d298238f602f25f84248ac7a5: [Backport #19587]
[Bug #19587] Fix `reset_match_cache` arguments
---
regexec.c | 2 +-
test/ruby/test_regexp.rb | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
| -rw-r--r-- | regexec.c | 2 | ||||
| -rw-r--r-- | test/ruby/test_regexp.rb | 8 | ||||
| -rw-r--r-- | version.h | 2 |
3 files changed, 10 insertions, 2 deletions
@@ -3483,7 +3483,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, default: goto unexpected_bytecode_error; } - reset_match_cache(reg, addr, pbegin, (long)(s - str), msa->match_cache, msa->cache_index_table, msa->num_cache_table ,msa->num_cache_opcode); + reset_match_cache(reg, addr, pbegin, (long)(s - str), msa->match_cache, msa->cache_index_table, msa->num_cache_opcode, msa->num_cache_table); } # endif } diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 80b652773d..b515ff8b14 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -1782,6 +1782,14 @@ class TestRegexp < Test::Unit::TestCase end; end + def test_cache_index_initialize + str = 'test1-test2-test3-test4-test_5' + re = '^([0-9a-zA-Z\-/]*){1,256}$' + 100.times do + assert !Regexp.new(re).match?(str) + end + end + def test_bug_19273 # [Bug #19273] pattern = /(?:(?:-?b)|(?:-?(?:1_?(?:0_?)*)?0))(?::(?:(?:-?b)|(?:-?(?:1_?(?:0_?)*)?0))){0,3}/ assert_equal("10:0:0".match(pattern)[0], "10:0:0") @@ -11,7 +11,7 @@ # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 2 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 85 +#define RUBY_PATCHLEVEL 86 #include "ruby/version.h" #include "ruby/internal/abi.h" |
