<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/regparse.c, 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>regparse possible memory leak fix proposal</title>
<updated>2024-09-26T07:34:22+00:00</updated>
<author>
<name>David Carlier</name>
<email>devnexen@gmail.com</email>
</author>
<published>2022-03-23T21:47:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8cd295ecf09e9419de0e3f3d4eecabfb430f9df1'/>
<id>8cd295ecf09e9419de0e3f3d4eecabfb430f9df1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove null checks for xfree</title>
<updated>2024-01-19T15:25:02+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-01-17T20:55:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d0b774cfb8ddf075c23d1b5ab1fc6f47123ccf65'/>
<id>d0b774cfb8ddf075c23d1b5ab1fc6f47123ccf65</id>
<content type='text'>
xfree can handle null values, so we don't need to check it.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
xfree can handle null values, so we don't need to check it.
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove a unused variable in i_print_name_entry (#9468)</title>
<updated>2024-01-11T13:38:44+00:00</updated>
<author>
<name>Hiroya Fujinami</name>
<email>make.just.on@gmail.com</email>
</author>
<published>2024-01-11T13:38:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=80f1c1e2937939d95374aee7215a68cef9c7175a'/>
<id>80f1c1e2937939d95374aee7215a68cef9c7175a</id>
<content type='text'>
A warning for this is shown when `ONIG_DEBUG_COMPILE` is enabled.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A warning for this is shown when `ONIG_DEBUG_COMPILE` is enabled.</pre>
</div>
</content>
</entry>
<entry>
<title>Fix memory leak in regexp grapheme clusters</title>
<updated>2024-01-09T00:50:34+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-01-08T15:09:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=37ed86fd3c798e298fad9db6e7df1f3f45e1e03b'/>
<id>37ed86fd3c798e298fad9db6e7df1f3f45e1e03b</id>
<content type='text'>
[Bug #20161]

The cc-&gt;mbuf gets overwritten, so we need to free it to not leak memory.

For example:

    str = "hello world".encode(Encoding::UTF_32LE)

    10.times do
      1_000.times do
        str.grapheme_clusters
      end

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

Before:

    15536
    15760
    15920
    16144
    16304
    16480
    16640
    16784
    17008
    17280

After:

    15584
    15584
    15760
    15824
    15888
    15888
    15888
    15888
    16048
    16112
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Bug #20161]

The cc-&gt;mbuf gets overwritten, so we need to free it to not leak memory.

For example:

    str = "hello world".encode(Encoding::UTF_32LE)

    10.times do
      1_000.times do
        str.grapheme_clusters
      end

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

Before:

    15536
    15760
    15920
    16144
    16304
    16480
    16640
    16784
    17008
    17280

After:

    15584
    15584
    15760
    15824
    15888
    15888
    15888
    15888
    16048
    16112
</pre>
</div>
</content>
</entry>
<entry>
<title>Improve error and memory handling</title>
<updated>2023-11-08T13:05:58+00:00</updated>
<author>
<name>Adam Hess</name>
<email>HParker@github.com</email>
</author>
<published>2023-11-07T06:46:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f694bd158c4aaffbbb9e4b2f0608c6d428a4999c'/>
<id>f694bd158c4aaffbbb9e4b2f0608c6d428a4999c</id>
<content type='text'>
Apply Nobu's suggestions which improve style, memory handling and error correction.

Co-authored-by: Nobuyoshi Nakada &lt;nobu@ruby-lang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Apply Nobu's suggestions which improve style, memory handling and error correction.

Co-authored-by: Nobuyoshi Nakada &lt;nobu@ruby-lang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fix regex from regex memory corruption</title>
<updated>2023-11-08T13:05:58+00:00</updated>
<author>
<name>Adam Hess</name>
<email>adamhess1991@gmail.com</email>
</author>
<published>2023-11-01T07:01:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=05cde4155cd43a79733ab4996db2d8b1f64c4fb5'/>
<id>05cde4155cd43a79733ab4996db2d8b1f64c4fb5</id>
<content type='text'>
before this change, creating a regex from a regex with a named capture, Regexp.new(/(?&lt;name&gt;)/), causes memory to be shared between the two named capture groups which can cause a segfault if the original is GCed.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
before this change, creating a regex from a regex with a named capture, Regexp.new(/(?&lt;name&gt;)/), causes memory to be shared between the two named capture groups which can cause a segfault if the original is GCed.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix onigmo name table without st</title>
<updated>2023-11-03T01:41:48+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-11-02T14:35:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5cff4c5aa375787924e2df5c0b981dd922b95a8c'/>
<id>5cff4c5aa375787924e2df5c0b981dd922b95a8c</id>
<content type='text'>
Co-authored-by: Adam Hess &lt;HParker@github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Co-authored-by: Adam Hess &lt;HParker@github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix functions for name tables as `st_foreach_callback_func`</title>
<updated>2023-11-02T06:00:39+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-11-02T03:53:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=4218e913d8d1d1e4c2fb123348fd98721e2b0ba8'/>
<id>4218e913d8d1d1e4c2fb123348fd98721e2b0ba8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Don't check for null pointer in calls to free</title>
<updated>2023-06-30T13:13:31+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-06-29T20:31:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=58386814a7c7275f66ffa111175fca2fe307a1b5'/>
<id>58386814a7c7275f66ffa111175fca2fe307a1b5</id>
<content type='text'>
According to the C99 specification section 7.20.3.2 paragraph 2:

&gt; If ptr is a null pointer, no action occurs.

So we do not need to check that the pointer is a null pointer.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
According to the C99 specification section 7.20.3.2 paragraph 2:

&gt; If ptr is a null pointer, no action occurs.

So we do not need to check that the pointer is a null pointer.
</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>
</feed>
