<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/include/ruby/onigmo.h, branch v3_4_9</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Fix memory leak in Regexp capture group when timeout</title>
<updated>2024-07-25T13:23:49+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-07-24T19:16:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=10574857ce167869524b97ee862b610928f6272f'/>
<id>10574857ce167869524b97ee862b610928f6272f</id>
<content type='text'>
[Bug #20650]

The capture group allocates memory that is leaked when it times out.

For example:

    re = Regexp.new("^#{"(a*)" * 10_000}x$", timeout: 0.000001)
    str = "a" * 1000000 + "x"

    10.times do
      100.times do
        re =~ str
      rescue Regexp::TimeoutError
      end

      puts `ps -o rss= -p #{$$}`
    end

Before:

    34688
    56416
    78288
    100368
    120784
    140704
    161904
    183568
    204320
    224800

After:

    16288
    16288
    16880
    16896
    16912
    16928
    16944
    17184
    17184
    17200
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Bug #20650]

The capture group allocates memory that is leaked when it times out.

For example:

    re = Regexp.new("^#{"(a*)" * 10_000}x$", timeout: 0.000001)
    str = "a" * 1000000 + "x"

    10.times do
      100.times do
        re =~ str
      rescue Regexp::TimeoutError
      end

      puts `ps -o rss= -p #{$$}`
    end

Before:

    34688
    56416
    78288
    100368
    120784
    140704
    161904
    183568
    204320
    224800

After:

    16288
    16288
    16880
    16896
    16912
    16928
    16944
    17184
    17184
    17200
</pre>
</div>
</content>
</entry>
<entry>
<title>Optimize `Regexp#dup` and `Regexp.new(/RE/)`</title>
<updated>2023-06-09T11:22:30+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-06-09T07:10:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ab6eb3786c94e69c561080cbb796c2381702a3a4'/>
<id>ab6eb3786c94e69c561080cbb796c2381702a3a4</id>
<content type='text'>
When copying from another regexp, copy already built `regex_t` instead
of re-compiling its source.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When copying from another regexp, copy already built `regex_t` instead
of re-compiling its source.
</pre>
</div>
</content>
</entry>
<entry>
<title>Refactor `Regexp#match` cache implementation (#7724)</title>
<updated>2023-04-19T04:08:28+00:00</updated>
<author>
<name>TSUYUSATO Kitsune</name>
<email>make.just.on@gmail.com</email>
</author>
<published>2023-04-19T04:08:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a1c2c274eebcc2a5275b677ebf94a8dbff380770'/>
<id>a1c2c274eebcc2a5275b677ebf94a8dbff380770</id>
<content type='text'>
* 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</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* 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</pre>
</div>
</content>
</entry>
<entry>
<title>Add `Regexp.linear_time?` (#6901)</title>
<updated>2022-12-14T03:57:14+00:00</updated>
<author>
<name>TSUYUSATO Kitsune</name>
<email>make.just.on@gmail.com</email>
</author>
<published>2022-12-14T03:57:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=fbedadb61f49ba3aaf4f07939b4fc7d0b8f8ac03'/>
<id>fbedadb61f49ba3aaf4f07939b4fc7d0b8f8ac03</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Reduce warnings</title>
<updated>2022-11-09T14:21:26+00:00</updated>
<author>
<name>TSUYUSATO Kitsune</name>
<email>make.just.on@gmail.com</email>
</author>
<published>2022-11-09T07:22:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1dc4128e92ed6e7af8556abdfb657c135f4e13b7'/>
<id>1dc4128e92ed6e7af8556abdfb657c135f4e13b7</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Refactor field names"</title>
<updated>2022-11-09T14:21:26+00:00</updated>
<author>
<name>TSUYUSATO Kitsune</name>
<email>make.just.on@gmail.com</email>
</author>
<published>2022-11-08T06:13:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a1c1fc558a0ee791e91a66cae5c9515679890339'/>
<id>a1c1fc558a0ee791e91a66cae5c9515679890339</id>
<content type='text'>
This reverts commit 1e6673d6bbd2adbf555d82c7c0906ceb148ed6ee.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 1e6673d6bbd2adbf555d82c7c0906ceb148ed6ee.
</pre>
</div>
</content>
</entry>
<entry>
<title>Refactor field names</title>
<updated>2022-11-09T14:21:26+00:00</updated>
<author>
<name>TSUYUSATO Kitsune</name>
<email>make.just.on@gmail.com</email>
</author>
<published>2022-11-08T06:05:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=22294731a82642ac63ed6708e0015361d05d6677'/>
<id>22294731a82642ac63ed6708e0015361d05d6677</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Support OP_REPEAT and OP_REPEAT_INC</title>
<updated>2022-11-09T14:21:26+00:00</updated>
<author>
<name>TSUYUSATO Kitsune</name>
<email>make.just.on@gmail.com</email>
</author>
<published>2022-10-20T07:52:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f25bb291b42a45d23cfc8658720c62e1f3a7390f'/>
<id>f25bb291b42a45d23cfc8658720c62e1f3a7390f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Prevent potential buffer overrun in onigmo</title>
<updated>2022-10-25T08:02:43+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2022-10-25T06:45:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1d2d25dcadda0764f303183ac091d0c87b432566'/>
<id>1d2d25dcadda0764f303183ac091d0c87b432566</id>
<content type='text'>
A code pattern `p + enclen(enc, p, pend)` may lead to a buffer overrun
if incomplete bytes of a UTF-8 character is placed at the end of a
string. Because this pattern is used in several places in onigmo,
this change fixes the issue in the side of `enclen`: the function should
not return a number that is larger than `pend - p`.

Co-Authored-By: Nobuyoshi Nakada &lt;nobu@ruby-lang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A code pattern `p + enclen(enc, p, pend)` may lead to a buffer overrun
if incomplete bytes of a UTF-8 character is placed at the end of a
string. Because this pattern is used in several places in onigmo,
this change fixes the issue in the side of `enclen`: the function should
not return a number that is larger than `pend - p`.

Co-Authored-By: Nobuyoshi Nakada &lt;nobu@ruby-lang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>re.c: Add Regexp.timeout= and Regexp.timeout</title>
<updated>2022-03-30T07:50:46+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2022-03-24T07:59:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ffc3b37f969a779f93b8f8a5b3591b4ef7de1538'/>
<id>ffc3b37f969a779f93b8f8a5b3591b4ef7de1538</id>
<content type='text'>
[Feature #17837]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Feature #17837]
</pre>
</div>
</content>
</entry>
</feed>
