diff options
| author | K.Takata <kentkt@csc.jp> | 2019-01-28 18:52:39 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu.nakada@gmail.com> | 2025-10-31 20:49:59 +0900 |
| commit | a89246834d8d2b60ece05b5ee34a012973b53df6 (patch) | |
| tree | c63a2c7653f12a48ce8d1bae4e7bc30c2802d8d8 | |
| parent | 54b963956b65f8333886e6afe4fb6d73e250148f (diff) | |
Fix initialization of the table for quick search
This fixes k-takata/Onigmo#120.
The commit k-takata/Onigmo@9c13de8d0684ebde97e3709d7693997c81ca374b was insufficient.
https://github.com/k-takata/Onigmo/commit/1de602ddff140d91419e3f86dd35c81d7bd2d8e7
| -rw-r--r-- | regcomp.c | 4 | ||||
| -rw-r--r-- | test/ruby/test_regexp.rb | 4 |
2 files changed, 6 insertions, 2 deletions
@@ -4309,8 +4309,6 @@ set_bm_skip(UChar* s, UChar* end, regex_t* reg, len = end - s; if (len < ONIG_CHAR_TABLE_SIZE) { - for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) skip[i] = (UChar )(len + 1); - if (ignore_case) { for (i = 0; i < len; i += clen) { p = s + i; @@ -4339,6 +4337,8 @@ endcheck: } len = end - s; + for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) + skip[i] = (UChar )(len + 1); n = 0; for (i = 0; i < len; i += clen) { p = s + i; diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index b69c148305..2d7a67dd54 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -1743,6 +1743,10 @@ class TestRegexp < Test::Unit::TestCase assert_raise(RegexpError, bug12418){ Regexp.new('(0?0|(?(5)||)|(?(5)||))?') } end + def test_quick_search + assert_match_at('(?i) *TOOKY', 'Mozilla/5.0 (Linux; Android 4.0.3; TOOKY', [[34, 40]]) # Issue #120 + end + def test_ss_in_look_behind assert_match_at("(?i:ss)", "ss", [[0, 2]]) assert_match_at("(?i:ss)", "Ss", [[0, 2]]) |
