summaryrefslogtreecommitdiff
path: root/regexec.c
AgeCommit message (Collapse)Author
2022-11-09Reduce warningsTSUYUSATO Kitsune
2022-11-09Use long instead of intTSUYUSATO Kitsune
2022-11-09Check for integer overflow in the allocation of match_cache tableYusuke Endoh
2022-11-09Ensure that the table size for CACHE_MATCH fits with intYusuke Endoh
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`.
2022-11-09Prevent GCC warningsYusuke Endoh
``` 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; | ^~ ```
2022-11-09Return ONIGERR_MEMORY if it fails to allocate memory for cache_match_optYusuke Endoh
2022-11-09Revert "Refactor field names"TSUYUSATO Kitsune
This reverts commit 1e6673d6bbd2adbf555d82c7c0906ceb148ed6ee.
2022-11-09Refactor field namesTSUYUSATO Kitsune
2022-11-09Remove debug printfTSUYUSATO Kitsune
2022-11-09Clear cache on OP_NULL_CHECK_END_MEMSTTSUYUSATO Kitsune
2022-11-09Support OP_REPEAT and OP_REPEAT_INCTSUYUSATO Kitsune
2022-11-09Reduce warningsTSUYUSATO Kitsune
2022-11-09Fix to compile when USE_CACHE_MATCH_OPT is disabledTSUYUSATO Kitsune
2022-11-09Enable optimization for PUSH_IF/OR opcodesTSUYUSATO Kitsune
2022-11-09Enable optimization for ANYCHAR_STAR opcodesTSUYUSATO Kitsune
2022-11-09Add index to the latest NULL_CHECK_STACK for fast matchingTSUYUSATO Kitsune
2022-11-09Add static declaration to new functionsTSUYUSATO Kitsune
2022-11-09Increment num_fail on OP_POP tooTSUYUSATO Kitsune
2022-11-09Fix look-around like operators and cclassTSUYUSATO Kitsune
2022-11-09Keep cache optimization info to MatchArg for global matchingTSUYUSATO Kitsune
2022-11-09Implement cache optimization for regexp matchingTSUYUSATO Kitsune
2022-03-30re.c: Add Regexp.timeout= and Regexp.timeoutYusuke Endoh
[Feature #17837] Notes: Merged: https://github.com/ruby/ruby/pull/5703
2022-03-29Fix multiplex backreferencs near end of string in regexp matchJeremy Evans
Idea from Jirka Marsik. Fixes [Bug #18631] Notes: Merged: https://github.com/ruby/ruby/pull/5710
2022-03-24regint.h: Reduce the frequency of rb_thread_check_intsYusuke Endoh
edc8576a65b7082597d45a694434261ec3ac0d9e checks interrupt at every backtrack, which brought significant overhead. This change makes the check only once every 128 backtracks. Notes: Merged: https://github.com/ruby/ruby/pull/5697
2022-03-10Allow interrupting regexps that backtrackJeremy Evans
Fixes [Bug #14103] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4960
2021-05-07Fixed shorten-64-to-32 errors when USE_COMBINATION_EXPLOSION_CHECKNobuyoshi Nakada
2019-04-24Only define history_root member of the Oniguruma re_registers struct if ↵Lourens Naudé
USE_CAPTURE_HISTORY is enabled
2018-01-02label as lvalue is a GCCismshyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-01re-apply r60755naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-01Update to Onigmo 6.1.3-669ac9997619954c298da971fcfacccf36909d05.naruse
[Bug #13892] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-13regexec.c: invalidate previously matched positionnobu
* regexec.c (match_at): invalidate end position not yet matched when new start position is pushed, to dispose previously stored position. [ruby-core:83743] [Bug #14101] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-11Merge Onigmo 6.1.1naruse
* Support absent operator https://github.com/k-takata/Onigmo/issues/82 * https://github.com/k-takata/Onigmo/blob/Onigmo-6.1.1/HISTORY git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-10Merge Onigmo 6.0.0naruse
* https://github.com/k-takata/Onigmo/blob/Onigmo-6.0.0/HISTORY * fix for ruby 2.4: https://github.com/k-takata/Onigmo/pull/78 * suppress warning: https://github.com/k-takata/Onigmo/pull/79 * include/ruby/oniguruma.h: include onigmo.h. * template/encdb.h.tmpl: ignore duplicated definition of EUC-CN in enc/euc_kr.c. It is defined in enc/gb2313.c with CRuby macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-03* regexec.c (OPCODE_EXEC_HOOK): op is p-1 because p is alreadynaruse
incremented. * regexec.c (OPCODE_EXEC_HOOK): use the exact end address. * regexec.c (match_at): don't call OPCODE_EXEC_HOOK in CASE() when it comes from goto fail. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-29* regexec.c (ONIGENC_IS_MBC_ASCII_WORD): redefine optimized one.naruse
WORD of Ruby's ascii compatible encoding is always [a-zA-Z0-9_]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-29* regexec.c (match_at): make compilers optimize harder.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-24regexec.c: constifynobu
* regexec.c (match_at): constify oplabels. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-22regexec.c: fix build with direct threaded VMnobu
* regexec.c (match_at): move direct threaded VM code to get rid of mixed declarations and code, and enable it only for gcc since it depends on a gcc extension. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-22regexec.c: enable direct threaded VMnobu
* regexec.c (USE_DIRECT_THREADED_VM): enable direct threaded VM by the default. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-26* remove trailing spaces.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-26* regcomp.c, regenc.c, regexec.c, regint.h, enc/unicode.c:naruse
Merge Onigmo 58fa099ed1a34367de67fb3d06dd48d076839692 + https://github.com/k-takata/Onigmo/pull/52 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-26uninitialized variablenobu
* process.c (rb_spawn_process): get rid of usage of uninitialized variable. reported by Denis Denisov <denji0k AT gmail.com>. * regexec.c (match_at): ditto. * ext/win32ole/win32ole.c (ole_wc2mb_alloc, ole_vstr2wc, ole_mb2wc): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-26fix printf format conversion specifiersnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-15* reg*.c: Merge Onigmo 5.15.0 38a870960aa7370051a3544naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-16* regcomp.c: Merge Onigmo 5.14.1 25a8a69fc05ae3b56a09.naruse
this includes Support for Unicode 7.0 [Bug #9092]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-01constify rb_encoding and OnigEncodingnobu
* include/ruby/encoding.h: constify `rb_encoding` arguments. * include/ruby/oniguruma.h: constify `OnigEncoding` arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-13* Merge Onigmo 5.13.4 f22cf2e566712cace60d17f84d63119d7c5764ee.naruse
[bug] fix problem with optimization of \z (Issue #16) [Bug #8210] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-11* Merge Onigmo d4bad41e16e3eccd97ccce6f1f96712e557c4518.naruse
fix lookbehind assertion fails with /m mode enabled. [Bug #8023] fix \Z matches where it shouldn't. [Bug #8001] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-01* Merge Onigmo 0fe387da2fee089254f6b04990541c731a26757fnaruse
v5.13.3 [Bug#7972] [Bug#7974] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-21* regcomp.c: Merge Onigmo 3d855b30d574536d3ae600260208c6624ae4791c.naruse
[Bug#6143] [Bug#6144] [Bug#6145] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e