Project

General

Profile

Bug #13596

Updated by mjones (Morgan Jones) over 7 years ago

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}" 
 ~~~ 

 ~~~ 
 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> 
 ~~~

Back