<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/regexec.c, branch v4.0.2</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Remove old code for BMH search</title>
<updated>2025-10-31T11:49:59+00:00</updated>
<author>
<name>K.Takata</name>
<email>kentkt@csc.jp</email>
</author>
<published>2019-01-29T09:59:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ba74fcd6e1079dd4c8482c56675ffa9d20fed7ac'/>
<id>ba74fcd6e1079dd4c8482c56675ffa9d20fed7ac</id>
<content type='text'>
Remove the code for Boyer-Moore-Horspool search.
Now we are using Sunday's quick search.

https://github.com/k-takata/Onigmo/commit/3d9072419a1578b742a422412d004fd8a54209fd
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove the code for Boyer-Moore-Horspool search.
Now we are using Sunday's quick search.

https://github.com/k-takata/Onigmo/commit/3d9072419a1578b742a422412d004fd8a54209fd
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix lgtm.com warnings</title>
<updated>2025-10-31T11:49:59+00:00</updated>
<author>
<name>K.Takata</name>
<email>kentkt@csc.jp</email>
</author>
<published>2019-01-25T09:56:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=daf0d6c686e77f6d4d561ba2350f05be28a90ed4'/>
<id>daf0d6c686e77f6d4d561ba2350f05be28a90ed4</id>
<content type='text'>
* Multiplication result may overflow 'int' before it is converted to
  'OnigDistance'.
* Comparison is always true because code &lt;= 122.
* This statement makes ExprStmt unreachable.
* Empty block without comment

https://github.com/k-takata/Onigmo/commit/387ad616c3cb9370f99d2b11198c2135fa07030f
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Multiplication result may overflow 'int' before it is converted to
  'OnigDistance'.
* Comparison is always true because code &lt;= 122.
* This statement makes ExprStmt unreachable.
* Empty block without comment

https://github.com/k-takata/Onigmo/commit/387ad616c3cb9370f99d2b11198c2135fa07030f
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix indents in Onigmo files to use spaces instead of tabs (#14047) [no ci]</title>
<updated>2025-07-31T04:08:54+00:00</updated>
<author>
<name>Hiroya Fujinami</name>
<email>make.just.on@gmail.com</email>
</author>
<published>2025-07-31T04:08:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=18f500e3475596c382b86f27a1461c8bf509ce1b'/>
<id>18f500e3475596c382b86f27a1461c8bf509ce1b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Port Oniguruma patches to prevent integer overflow (#14027)</title>
<updated>2025-07-30T11:56:13+00:00</updated>
<author>
<name>Hiroya Fujinami</name>
<email>make.just.on@gmail.com</email>
</author>
<published>2025-07-30T11:56:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=66bcb69054c7dc74462b141d915db02f5bc77128'/>
<id>66bcb69054c7dc74462b141d915db02f5bc77128</id>
<content type='text'>
* Port a Oniguruma patch: Integer overflow in forward_search_range()

https://github.com/kkos/oniguruma/commit/db64ef3189f54917a5008a02bdb000adc514a90a

Co-Authored-By: K.Kosako &lt;kkos@users.noreply.github.com&gt;

* Port a Oniguruma patch: Integer overflow in backward_search_range() and onig_search_gpos()

https://github.com/kkos/oniguruma/commit/bfc36d3d8139b8be4d3df630d625c58687b0c7d4

Co-Authored-By: K.Kosako &lt;kkos@users.noreply.github.com&gt;

* Port a Oniguruma patch: Integer overflow in onig_search_gpos()

https://github.com/kkos/oniguruma/commit/778a43dd56925ed58bbe26e3a7bb8202d72c3f3f

It differs from the Oniguruma patch in that it dosen't use `onigenc_get_prev_char_head()`
because this function's signature has been changed by Oniguruma and the change is not ported
in Onigmo for now. This patch respects the current Onigmo implementation.

Co-Authored-By: K.Kosako &lt;kkos@users.noreply.github.com&gt;

* Add castings to prevent warnings

* Correct castings to use OnigDistance

---------

Co-authored-by: K.Kosako &lt;kkos@users.noreply.github.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Port a Oniguruma patch: Integer overflow in forward_search_range()

https://github.com/kkos/oniguruma/commit/db64ef3189f54917a5008a02bdb000adc514a90a

Co-Authored-By: K.Kosako &lt;kkos@users.noreply.github.com&gt;

* Port a Oniguruma patch: Integer overflow in backward_search_range() and onig_search_gpos()

https://github.com/kkos/oniguruma/commit/bfc36d3d8139b8be4d3df630d625c58687b0c7d4

Co-Authored-By: K.Kosako &lt;kkos@users.noreply.github.com&gt;

* Port a Oniguruma patch: Integer overflow in onig_search_gpos()

https://github.com/kkos/oniguruma/commit/778a43dd56925ed58bbe26e3a7bb8202d72c3f3f

It differs from the Oniguruma patch in that it dosen't use `onigenc_get_prev_char_head()`
because this function's signature has been changed by Oniguruma and the change is not ported
in Onigmo for now. This patch respects the current Onigmo implementation.

Co-Authored-By: K.Kosako &lt;kkos@users.noreply.github.com&gt;

* Add castings to prevent warnings

* Correct castings to use OnigDistance

---------

Co-authored-by: K.Kosako &lt;kkos@users.noreply.github.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Align styles [ci skip]</title>
<updated>2025-05-15T08:48:40+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2025-05-15T08:48:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2e3f81838c6bf6408c154eee840a231312666fcd'/>
<id>2e3f81838c6bf6408c154eee840a231312666fcd</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix memoization for the `/(...){0}/` case (#13169)</title>
<updated>2025-04-24T12:03:24+00:00</updated>
<author>
<name>Hiroya Fujinami</name>
<email>make.just.on@gmail.com</email>
</author>
<published>2025-04-24T12:03:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=18f8c514ea1c97c5ecbbf285d2f529284247f423'/>
<id>18f8c514ea1c97c5ecbbf285d2f529284247f423</id>
<content type='text'>
In this case, the previous implementation counted an extra number of
opcodes to cache and the matching was unstable on memoization.

This patch is to fix that problem by not counting an number of opcodes
to cache in the parentheses of `(...){0}`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In this case, the previous implementation counted an extra number of
opcodes to cache and the matching was unstable on memoization.

This patch is to fix that problem by not counting an number of opcodes
to cache in the parentheses of `(...){0}`.</pre>
</div>
</content>
</entry>
<entry>
<title>Fix macro for disabled match cache</title>
<updated>2025-04-13T02:44:49+00:00</updated>
<author>
<name>Daniel Colson</name>
<email>danieljamescolson@gmail.com</email>
</author>
<published>2025-04-12T18:04:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=29b26fd3e7a881399b69665184be41ee6d47da6f'/>
<id>29b26fd3e7a881399b69665184be41ee6d47da6f</id>
<content type='text'>
The `MEMOIZE_LOOKAROUND_MATCH_CACHE_POINT` macro needs an argument
otherwise we end up with:

```
../regexec.c:3955:2: error: called object type 'void' is not a function or function pointer
 3955 |         STACK_POS_END(stkp);
      |         ^~~~~~~~~~~~~~~~~~~
../regexec.c:1680:41: note: expanded from macro 'STACK_POS_END'
 1680 |     MEMOIZE_LOOKAROUND_MATCH_CACHE_POINT(k);\
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
../regexec.c:3969:7: error: called object type 'void' is not a function or function pointer
 3969 |       STACK_POP_TIL_POS_NOT;
      |       ^~~~~~~~~~~~~~~~~~~~~
../regexec.c:1616:41: note: expanded from macro 'STACK_POP_TIL_POS_NOT'
 1616 |     MEMOIZE_LOOKAROUND_MATCH_CACHE_POINT(stk);\
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
```

The macro definition with the match cache enabled already has the
correct argument. This one is for when the match cache is disabled (I
had disabled it while trying to learn more about how it works.)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `MEMOIZE_LOOKAROUND_MATCH_CACHE_POINT` macro needs an argument
otherwise we end up with:

```
../regexec.c:3955:2: error: called object type 'void' is not a function or function pointer
 3955 |         STACK_POS_END(stkp);
      |         ^~~~~~~~~~~~~~~~~~~
../regexec.c:1680:41: note: expanded from macro 'STACK_POS_END'
 1680 |     MEMOIZE_LOOKAROUND_MATCH_CACHE_POINT(k);\
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
../regexec.c:3969:7: error: called object type 'void' is not a function or function pointer
 3969 |       STACK_POP_TIL_POS_NOT;
      |       ^~~~~~~~~~~~~~~~~~~~~
../regexec.c:1616:41: note: expanded from macro 'STACK_POP_TIL_POS_NOT'
 1616 |     MEMOIZE_LOOKAROUND_MATCH_CACHE_POINT(stk);\
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
```

The macro definition with the match cache enabled already has the
correct argument. This one is for when the match cache is disabled (I
had disabled it while trying to learn more about how it works.)
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix regex timeout double-free after stack_double</title>
<updated>2024-11-12T07:33:21+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2024-11-05T02:05:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8409edc4971f34cf0d77c375909c5b8f7b1e058a'/>
<id>8409edc4971f34cf0d77c375909c5b8f7b1e058a</id>
<content type='text'>
As of 10574857ce167869524b97ee862b610928f6272f, it's possible to crash
on a double free due to `stk_alloc` AKA `msa-&gt;stack_p` being freed
twice, once at the end of match_at and a second time in `FREE_MATCH_ARG`
in the parent caller.

Fixes [Bug #20886]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As of 10574857ce167869524b97ee862b610928f6272f, it's possible to crash
on a double free due to `stk_alloc` AKA `msa-&gt;stack_p` being freed
twice, once at the end of match_at and a second time in `FREE_MATCH_ARG`
in the parent caller.

Fixes [Bug #20886]
</pre>
</div>
</content>
</entry>
<entry>
<title>[DOC] Fix typos</title>
<updated>2024-10-31T03:44:50+00:00</updated>
<author>
<name>kojix2</name>
<email>2xijok@gmail.com</email>
</author>
<published>2024-10-31T03:44:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=550ac2f2edc07d1b63e3755233df0758a652b53f'/>
<id>550ac2f2edc07d1b63e3755233df0758a652b53f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix size modifier for `size_t`</title>
<updated>2024-09-25T01:40:14+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-09-25T01:40:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c94ea1cccb24a41a5cd5c7e90aec04cb477b367e'/>
<id>c94ea1cccb24a41a5cd5c7e90aec04cb477b367e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
