aboutsummaryrefslogtreecommitdiffstats
path: root/regexec.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix regex match cache out-of-bounds accessAlan Wu2023-11-161-1/+1
| | | | | | | | | | Previously the following read and wrote 1 byte out-of-bounds: $ valgrind ruby -e 'p /(\W+)[bx]\?/i.match? "aaaaaa aaaaaaaaa aaaa aaaaaaaa aaa aaaaxaaaaaaaaaaa aaaaa aaaaaaaaaaaa a ? aaa aaaa a ?"' 2> >(grep Invalid -A 30) Because of the `match_cache_point_index + 1` in memoize_extended_match_cache_point() and check_extended_match_cache_point(), we need one more byte of space.
* Optimize regexp matching for look-around and atomic groups (#7931)Hiroya Fujinami2023-10-301-151/+224
|
* Add function rb_reg_onig_matchPeter Zhu2023-07-271-2/+6
| | | | | | rb_reg_onig_match performs preparation, error handling, and cleanup for matching a regex against a string. This reduces repetitive code and removes the need for StringScanner to access internal data of regex.
* Don't check for null pointer in calls to freePeter Zhu2023-06-301-12/+12
| | | | | | | | According to the C99 specification section 7.20.3.2 paragraph 2: > If ptr is a null pointer, no action occurs. So we do not need to check that the pointer is a null pointer.
* Allow the match cache optimization for atomic groups (#7804)TSUYUSATO Kitsune2023-05-221-0/+4
|
* Remove warnings and errors in `regexec.c` with `ONIG_DEBUG_...` macros (#7803)TSUYUSATO Kitsune2023-05-131-3/+3
|
* Delay start of the match cache optimization (#7738)TSUYUSATO Kitsune2023-05-041-9/+16
|
* Refactor `Regexp#match` cache implementation (#7724)TSUYUSATO Kitsune2023-04-191-311/+408
| | | | | | | | | | * Refactor Regexp#match cache implementation Improved variable and function names Fixed [Bug 19537] (Maybe fixed in https://github.com/ruby/ruby/pull/7694) * Add a comment of the glossary for "match cache" * Skip to reset match cache when no cache point on null check
* Fix `PLATFORM_GET_INC`Nobuyoshi Nakada2023-04-161-1/+1
| | | | | | | | On platforms where unaligned word access is not allowed, and if `sizeof(val)` and `sizeof(type)` differ: - `val` > `type`, `val` will be a garbage. - `val` < `type`, outside `val` will be clobbered.
* [Bug #19587] Fix `reset_match_cache` argumentsNobuyoshi Nakada2023-04-121-1/+1
|
* ConstifyNobuyoshi Nakada2023-04-121-6/+6
|
* Extract `bsearch_cache_index` functionNobuyoshi Nakada2023-04-121-21/+18
|
* [Bug #19476]: correct cache index computation for repetition (#7457)TSUYUSATO Kitsune2023-03-131-2/+2
|
* [Bug #19467] correct cache points and counting failure on ↵TSUYUSATO Kitsune2023-03-131-4/+16
| | | | `OP_ANYCHAR_STAR_PEEK_NEXT` (#7454)
* Fix [Bug 19273], set correct value to `outer_repeat` on `OP_REPEAT` (#7035)TSUYUSATO Kitsune2022-12-281-1/+1
|
* Adjust style [ci skip]Nobuyoshi Nakada2022-12-221-6/+13
|
* Add `Regexp.linear_time?` (#6901)TSUYUSATO Kitsune2022-12-141-1/+15
|
* Make absent operator work at the end of the input stringYusuke Endoh2022-12-121-0/+5
| | | | https://bugs.ruby-lang.org/issues/19104#change-100542
* Add default cases for cache point finding functionTSUYUSATO Kitsune2022-11-171-34/+60
|
* Add OP_CCLASS_MB caseTSUYUSATO Kitsune2022-11-171-0/+1
|
* Reduce warningsTSUYUSATO Kitsune2022-11-091-10/+8
|
* Use long instead of intTSUYUSATO Kitsune2022-11-091-15/+15
|
* Check for integer overflow in the allocation of match_cache tableYusuke Endoh2022-11-091-0/+4
|
* Ensure that the table size for CACHE_MATCH fits with intYusuke Endoh2022-11-091-1/+1
| | | | | Currently, the keys for CACHE_MATCH are handled as an `int` type. So we should make sure the table size are smaller than the range of `int`.
* Prevent GCC warningsYusuke Endoh2022-11-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` regexec.c: In function ‘reset_match_cache’: regexec.c:1259:56: warning: suggest parentheses around ‘-’ inside ‘<<’ [-Wparentheses] 1259 | match_cache[k1 >> 3] &= ((1 << (8 - (k2 & 7) - 1)) - 1 << ((k2 & 7) + 1)) | ((1 << (k1 & 7)) - 1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ regexec.c:1269:60: warning: suggest parentheses around ‘-’ inside ‘<<’ [-Wparentheses] 1269 | match_cache[k2 >> 3] &= ((1 << (8 - (k2 & 7) - 1)) - 1 << ((k2 & 7) + 1)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ regexec.c: In function ‘find_cache_index_table’: regexec.c:1192:11: warning: ‘m’ may be used uninitialized [-Wmaybe-uninitialized] 1192 | if (!(0 <= m && m < num_cache_table && table[m].addr == p)) { | ~~^~~~ regexec.c: In function ‘match_at’: regexec.c:1238:12: warning: ‘m1’ is used uninitialized [-Wuninitialized] 1238 | if (table[m1].addr < pbegin && m1 + 1 < num_cache_table) m1++; | ^ regexec.c:1218:39: note: ‘m1’ was declared here 1218 | int l = 0, r = num_cache_table - 1, m1, m2; | ^~ regexec.c:1239:12: warning: ‘m2’ is used uninitialized [-Wuninitialized] 1239 | if (table[m2].addr > pend && m2 - 1 > 0) m2--; | ^ regexec.c:1218:43: note: ‘m2’ was declared here 1218 | int l = 0, r = num_cache_table - 1, m1, m2; | ^~ ```
* Return ONIGERR_MEMORY if it fails to allocate memory for cache_match_optYusuke Endoh2022-11-091-7/+9
|
* Revert "Refactor field names"TSUYUSATO Kitsune2022-11-091-147/+156
| | | | This reverts commit 1e6673d6bbd2adbf555d82c7c0906ceb148ed6ee.
* Refactor field namesTSUYUSATO Kitsune2022-11-091-156/+147
|
* Remove debug printfTSUYUSATO Kitsune2022-11-091-12/+0
|
* Clear cache on OP_NULL_CHECK_END_MEMSTTSUYUSATO Kitsune2022-11-091-17/+95
|
* Support OP_REPEAT and OP_REPEAT_INCTSUYUSATO Kitsune2022-11-091-38/+180
|
* Reduce warningsTSUYUSATO Kitsune2022-11-091-26/+6
|
* Fix to compile when USE_CACHE_MATCH_OPT is disabledTSUYUSATO Kitsune2022-11-091-7/+29
|
* Enable optimization for PUSH_IF/OR opcodesTSUYUSATO Kitsune2022-11-091-0/+2
|
* Enable optimization for ANYCHAR_STAR opcodesTSUYUSATO Kitsune2022-11-091-0/+4
|
* Add index to the latest NULL_CHECK_STACK for fast matchingTSUYUSATO Kitsune2022-11-091-4/+17
|
* Add static declaration to new functionsTSUYUSATO Kitsune2022-11-091-3/+3
|
* Increment num_fail on OP_POP tooTSUYUSATO Kitsune2022-11-091-4/+15
|
* Fix look-around like operators and cclassTSUYUSATO Kitsune2022-11-091-43/+25
|
* Keep cache optimization info to MatchArg for global matchingTSUYUSATO Kitsune2022-11-091-35/+26
|
* Implement cache optimization for regexp matchingTSUYUSATO Kitsune2022-11-091-1/+468
|
* re.c: Add Regexp.timeout= and Regexp.timeoutYusuke Endoh2022-03-301-0/+2
| | | | [Feature #17837]
* Fix multiplex backreferencs near end of string in regexp matchJeremy Evans2022-03-291-2/+4
| | | | | | Idea from Jirka Marsik. Fixes [Bug #18631]
* regint.h: Reduce the frequency of rb_thread_check_intsYusuke Endoh2022-03-241-0/+2
| | | | | | | edc8576a65b7082597d45a694434261ec3ac0d9e checks interrupt at every backtrack, which brought significant overhead. This change makes the check only once every 128 backtracks.
* Allow interrupting regexps that backtrackJeremy Evans2022-03-101-0/+1
| | | | | | Fixes [Bug #14103] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
* Fixed shorten-64-to-32 errors when USE_COMBINATION_EXPLOSION_CHECKNobuyoshi Nakada2021-05-071-4/+4
|
* Only define history_root member of the Oniguruma re_registers struct if ↵Lourens Naudé2019-04-241-0/+2
| | | | USE_CAPTURE_HISTORY is enabled
* label as lvalue is a GCCismshyouhei2018-01-021-3/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* re-apply r60755naruse2017-12-011-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Update to Onigmo 6.1.3-669ac9997619954c298da971fcfacccf36909d05.naruse2017-12-011-20/+25
| | | | | | [Bug #13892] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e