https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112014-03-04T03:31:00ZRuby Issue Tracking SystemRuby master - Bug #9589: Stack level too deep during eval causes segmentation faulthttps://bugs.ruby-lang.org/issues/9589?journal_id=456082014-03-04T03:31:00ZCezary (Cezary Baginski)cezary.baginski@gmail.com
<ul></ul><p>Not sure if it's related, but I'm getting segfaults instead of SystemStackErrors with recursive lambda calls from:</p>
<p>example_spec.rb:</p>
<p><code>describe Fixnum do subject { subject } it { should be } end</code></p>
<p>by running:</p>
<p><code>rspec example_spec.rb</code></p>
<p>using this version of rspec:</p>
<p><code>rspec (2.14.1) rspec-core (2.14.8)</code></p>
<p>Both on:</p>
<p><code>ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]</code></p>
<p>and:</p>
<p><code>ruby 2.2.0dev (2014-03-04 trunk 45264) [x86_64-linux]</code></p>
<p>but the debug build of 2.2.0 (-O0 and -ggdb3) gives SystemStackError as expected.</p>
<p>(all examples compiled with gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3)</p> Ruby master - Bug #9589: Stack level too deep during eval causes segmentation faulthttps://bugs.ruby-lang.org/issues/9589?journal_id=456352014-03-05T07:01:39Zcarlosayam (carlos aya)carlosayam@yahoo.com.au
<ul></ul><p>Interesting, I searched the rspec-core code and it uses instance_eval/class_eval. That prompted me to try these faulty snippets...</p>
<p><code>b = Proc.new do b.instance_eval(&b) end b.instance_eval(&b) </code></p>
<p>and this one too...</p>
<p><code>b = Proc.new do Proc.class_eval(&b) end Proc.class_eval(&b) </code></p>
<p>Both segfault. I suspect eval, instance_eval and class_eval are not guarded against stack errors (again v.1.9.3 not sure about 2.x).</p> Ruby master - Bug #9589: Stack level too deep during eval causes segmentation faulthttps://bugs.ruby-lang.org/issues/9589?journal_id=474102014-06-27T08:15:06Zrunephilosof (Rune Philosof)rune.ruby-lang@philosof.dk
<ul></ul><p>This bug should be against the newest ruby stable 2.1.2, but I cannot change that.<br>
I just encountered it in a spec that looks like this:<br>
require 'spec_helper'</p>
<p>describe "test" do<br>
let(:die) { "this is fine" }<br>
context "with bad context" do<br>
let(:die) { die + ", but this will fail" }<br>
it "it throws segmentation fault" do<br>
expect { die }.to raise_error("Segmentation Fault")<br>
end<br>
end<br>
end</p>
<p>This is with ruby 2.1.2 and rspec-core 2.14.8</p> Ruby master - Bug #9589: Stack level too deep during eval causes segmentation faulthttps://bugs.ruby-lang.org/issues/9589?journal_id=474722014-06-30T08:51:58Zdecuplet (Nikita Shilnikov)fg@flashgordon.ru
<ul></ul><p>This command fails with segfault on 2.1.1 and 2.1.2:<br>
ruby -e 'define_method(:bar) {send(:bar)}; bar'<br>
It's OK on 2.0.0 and below.</p> Ruby master - Bug #9589: Stack level too deep during eval causes segmentation faulthttps://bugs.ruby-lang.org/issues/9589?journal_id=814972019-09-10T03:21:35Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>Backport</strong> deleted (<del><i>1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN</i></del>)</li></ul><p>From my testing with <code>class Object; define_method(:bar) {send(:bar)}; bar end</code>:</p>
<p>1.9-2.1: SystemStackError<br>
2.2-2.4: segfault<br>
2.5-master: SystemStackError</p>
<p>As this issue appears to have been fixed, closing. If you can reproduce with a currently supported Ruby version, please post back here.</p>