[ruby-core:81369] [Ruby trunk Bug#13596] Segfault when catching SystemStackError in eval

From: integ3rs@...
Date: 2017-05-24 06:46:50 UTC
List: ruby-core #81369
Issue #13596 has been updated by mjones (Morgan Jones).


Updated description to add a successful testcase.

----------------------------------------
Bug #13596: Segfault when catching SystemStackError in eval
https://bugs.ruby-lang.org/issues/13596#change-65067

* Author: mjones (Morgan Jones)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
This minimal testcase will crash most ruby versions with a SIGSEGV (though it's likely that other constructions could trigger the same behavior). Effectively, after the first SystemStackError that is caught from eval, a subsequent stack overflow will crash ruby rather than triggering another SystemStackError.

Failing testcase:

~~~
ruby -e "code = '+1' * 100000; 2.times {begin; eval code; rescue SystemStackError => e; p e; end}"
~~~

~~~
#<SystemStackError: stack level too deep>
[1]    23587 segmentation fault (core dumped)  ruby -e
~~~

Succeeding testcase:

~~~
ruby -e "def x; x; end; 2.times {begin; x; rescue SystemStackError => e; p e; end}"
~~~

~~~
#<SystemStackError: stack level too deep>
#<SystemStackError: stack level too deep>
~~~



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next