[#65451] [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string — ko1@...
Issue #10333 has been updated by Koichi Sasada.
9 messages
2014/10/07
[#65458] Re: [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string
— Eric Wong <normalperson@...>
2014/10/07
[email protected] wrote:
[#65502] Re: [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string
— Eric Wong <normalperson@...>
2014/10/08
Eric Wong <[email protected]> wrote:
[#65538] Re: [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string
— Eric Wong <normalperson@...>
2014/10/09
Eric Wong <[email protected]> wrote:
[#65549] Re: [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string
— SASADA Koichi <ko1@...>
2014/10/09
On 2014/10/09 11:04, Eric Wong wrote:
[#65551] Re: [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string
— Eric Wong <normalperson@...>
2014/10/09
SASADA Koichi <[email protected]> wrote:
[#65453] [ruby-trunk - Feature #10328] [PATCH] make OPT_SUPPORT_JOKE a proper VM option — ko1@...
Issue #10328 has been updated by Koichi Sasada.
3 messages
2014/10/07
[#65559] is there a name for this? — Xavier Noria <fxn@...>
When describing stuff about constants (working in their guide), you often
7 messages
2014/10/09
[#65560] Re: is there a name for this?
— Nobuyoshi Nakada <nobu@...>
2014/10/09
On 2014/10/09 20:41, Xavier Noria wrote:
[#65561] Re: is there a name for this?
— Xavier Noria <fxn@...>
2014/10/09
On Thu, Oct 9, 2014 at 1:59 PM, Nobuyoshi Nakada <[email protected]> wrote:
[#65566] [ruby-trunk - Feature #10351] [Open] [PATCH] prevent CVE-2014-6277 — shyouhei@...
Issue #10351 has been reported by Shyouhei Urabe.
3 messages
2014/10/09
[#65741] Re: [ruby-cvs:55121] normal:r47971 (trunk): test/ruby/test_rubyoptions.rb: fix race — Nobuyoshi Nakada <nobu@...>
On 2014/10/16 10:10, [email protected] wrote:
5 messages
2014/10/16
[#65742] Re: [ruby-cvs:55121] normal:r47971 (trunk): test/ruby/test_rubyoptions.rb: fix race
— Eric Wong <normalperson@...>
2014/10/16
Nobuyoshi Nakada <[email protected]> wrote:
[#65750] Re: [ruby-cvs:55121] normal:r47971 (trunk): test/ruby/test_rubyoptions.rb: fix race
— Tanaka Akira <akr@...>
2014/10/16
2014-10-16 12:48 GMT+09:00 Eric Wong <[email protected]>:
[#65753] [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string — ko1@...
Issue #10333 has been updated by Koichi Sasada.
3 messages
2014/10/16
[#65818] [ruby-trunk - Feature #10351] [PATCH] prevent CVE-2014-6277 — shyouhei@...
Issue #10351 has been updated by Shyouhei Urabe.
3 messages
2014/10/20
[ruby-core:65914] [ruby-trunk - Bug #10428] Segmentation fault when modifying local variables of binding obtained from the result of Method#to_proc
From:
nobu@...
Date:
2014-10-27 03:30:24 UTC
List:
ruby-core #65914
Issue #10428 has been updated by Nobuyoshi Nakada.
Related to Backport #2099: Error when getting binding for a method via converting it to a Proc added
----------------------------------------
Bug #10428: Segmentation fault when modifying local variables of binding obtained from the result of Method#to_proc
https://bugs.ruby-lang.org/issues/10428#change-49650
* Author: Stanislav Gatev
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
* ruby -v: 2.1.3p242 (2014-09-19 revision 47630)
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
The issue pops up when Method#to_proc is called, then the binding of that proc is obtained, and one tries to modify (get/set) the local variables in that binding.
Lets examine the code below.
```
class Foo
def bar
end
end
instance = Foo.new
method_proc = instance.method(:bar).to_proc
b = method_proc.binding
b.local_variable_set(:value, [1, 2, 3])
```
Running this code with `ruby 2.1.3p242 (2014-09-19 revision 47630)` on OS X results in Segmentation Fault:
```
bug.rb:10: [BUG] Segmentation fault at 0x00000000000070
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin14.0]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
-- Control frame information -----------------------------------------------
c:0003 p:---- s:0012 e:000011 CFUNC :local_variable_set
c:0002 p:0053 s:0007 E:001780 EVAL bug.rb:10 [FINISH]
c:0001 p:0000 s:0002 E:001838 TOP [FINISH]
bug.rb:10:in `<main>'
bug.rb:10:in `local_variable_set'
-- C level backtrace information -------------------------------------------
0 libruby.2.1.0.dylib 0x0000000104099ff0 rb_vm_bugreport + 144
1 libruby.2.1.0.dylib 0x0000000103f4b251 report_bug + 305
2 libruby.2.1.0.dylib 0x0000000103f4b114 rb_bug + 180
3 libruby.2.1.0.dylib 0x000000010401c04c sigsegv + 156
4 libsystem_platform.dylib 0x00007fff8fb45f1a _sigtramp + 26
5 libruby.2.1.0.dylib 0x0000000103f5cfe0 bind_local_variable_set + 128
6 ??? 0x0000000000003170 0x0 + 12656
-- Other runtime information -----------------------------------------------
* Loaded script: bug.rb
* Loaded features:
0 enumerator.so
1 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/x86_64-darwin14.0/enc/encdb.bundle
2 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/x86_64-darwin14.0/enc/trans/transdb.bundle
3 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/x86_64-darwin14.0/rbconfig.rb
4 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/compatibility.rb
5 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/defaults.rb
6 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/deprecate.rb
7 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/errors.rb
8 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/version.rb
9 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/requirement.rb
10 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/platform.rb
11 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/basic_specification.rb
12 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/stub_specification.rb
13 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb
14 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/exceptions.rb
15 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb
16 thread.rb
17 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/x86_64-darwin14.0/thread.bundle
18 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/monitor.rb
19 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb
20 /Users/s2gatev/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems.rb
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
Don't forget to include the above Crash Report log file.
For details: http://www.ruby-lang.org/bugreport.html
```
I noticed the same issue is present in the trunk. The functionality for getting Proc out of Method seems to be discussed and accepted. I noticed that it was introduced with [f331b55](https://github.com/ruby/ruby/commit/f331b5584edbf106ab85f4663ddbe55031176b3a).
Perhaps I am not getting something right but I'm wondering if you have considered this scenario when introducing the change?
I have suggested a fix on [GitHub](https://github.com/ruby/ruby/pull/746). I'm not sure if it is correct and would like to receive some feedback on it.
--
https://bugs.ruby-lang.org/