<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_proc.rb, 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 use-after-free in ep in Proc#dup for ifunc procs</title>
<updated>2024-12-13T15:10:03+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-12-12T19:03:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=92dd9734a967c20e628c8f77c5ce700058dcd58c'/>
<id>92dd9734a967c20e628c8f77c5ce700058dcd58c</id>
<content type='text'>
[Bug #20950]

ifunc proc has the ep allocated in the cfunc_proc_t which is the data of
the TypedData object. If an ifunc proc is duplicated, the ep points to
the ep of the source object. If the source object is freed, then the ep
of the duplicated object now points to a freed memory region. If we try
to use the ep we could crash.

For example, the following script crashes:

    p = { a: 1 }.to_proc
    100.times do
      p = p.dup
      GC.start
      p.call
    rescue ArgumentError
    end

This commit changes ifunc proc to also duplicate the ep when it is duplicated.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Bug #20950]

ifunc proc has the ep allocated in the cfunc_proc_t which is the data of
the TypedData object. If an ifunc proc is duplicated, the ep points to
the ep of the source object. If the source object is freed, then the ep
of the duplicated object now points to a freed memory region. If we try
to use the ep we could crash.

For example, the following script crashes:

    p = { a: 1 }.to_proc
    100.times do
      p = p.dup
      GC.start
      p.call
    rescue ArgumentError
    end

This commit changes ifunc proc to also duplicate the ep when it is duplicated.
</pre>
</div>
</content>
</entry>
<entry>
<title>Skip TestProc#test_hash_does_not_change_after_compaction if compaction is not supported</title>
<updated>2024-11-02T21:25:16+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-11-01T20:00:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3e2ee990576ac64eabc5b186cae68c4e4e814701'/>
<id>3e2ee990576ac64eabc5b186cae68c4e4e814701</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Improve coverage of TestProc#test_hash_uniqueness</title>
<updated>2024-11-01T14:49:50+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-10-31T15:02:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c7708d22c33040a74ea7ac683bf7407d3759edfe'/>
<id>c7708d22c33040a74ea7ac683bf7407d3759edfe</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add TestProc#test_hash_equal</title>
<updated>2024-11-01T14:49:50+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-10-31T14:52:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=813286762c29e2f8d8f9cb077fecdac3a2ec7c09'/>
<id>813286762c29e2f8d8f9cb077fecdac3a2ec7c09</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Rename test_hash to test_hash_uniqueness</title>
<updated>2024-11-01T14:49:50+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-10-31T14:31:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=53b3fac6d2dd11fe2416eb159aed6f1c565451be'/>
<id>53b3fac6d2dd11fe2416eb159aed6f1c565451be</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #20853] Fix Proc#hash to not change after compaction</title>
<updated>2024-11-01T14:49:50+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-10-30T20:41:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=29c480dd6fca993590c82078ba797e2c4e876ac7'/>
<id>29c480dd6fca993590c82078ba797e2c4e876ac7</id>
<content type='text'>
The hash value of a Proc must remain constant after a compaction, otherwise
it may not work as the key in a hash table.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The hash value of a Proc must remain constant after a compaction, otherwise
it may not work as the key in a hash table.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix assertion when envval of proc is Qundef</title>
<updated>2024-10-31T17:52:24+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-10-31T15:31:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=843b4f49ee82c572405d466f28d4305e21d6e6c2'/>
<id>843b4f49ee82c572405d466f28d4305e21d6e6c2</id>
<content type='text'>
The following code crashes with assertions enabled because envval could
be Qundef:

    {}.to_proc.dup
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The following code crashes with assertions enabled because envval could
be Qundef:

    {}.to_proc.dup
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix indentation in TestProc#test_hash [ci skip]</title>
<updated>2024-10-31T14:58:30+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-10-31T14:58:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=66afde9ceaafe92f8727087332939bc94fadcbdf'/>
<id>66afde9ceaafe92f8727087332939bc94fadcbdf</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Prevent warnings: the block passed to ... may be ignored</title>
<updated>2024-09-15T01:06:11+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2024-09-15T01:06:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=532af89e3b5b78dd3a6fe29c6cc64ad1b073afe2'/>
<id>532af89e3b5b78dd3a6fe29c6cc64ad1b073afe2</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Prevent warnings "the block passed to ... may be ignored"</title>
<updated>2024-09-13T07:52:38+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2024-09-13T04:48:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0f3dc2f958bd1447cc459bc4a4f39071a6a07a9c'/>
<id>0f3dc2f958bd1447cc459bc4a4f39071a6a07a9c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
