Project

General

Profile

Bug #7009

Updated by nobu (Nobuyoshi Nakada) over 11 years ago

=begin 
 Given the following code: 

  def 

 (({def method_missing(sym, *args) 
    
   foo(sym, *args) 
  
 end 

  bar 

 bar})) 

 When (({bar})) is called, it triggers method_missing (because bar is undefined). Inside method_missing, it calls (({foo})) (another undefined method), and that in turn calls method_missing, but this time the method name and the rest of the arguments are passed back to method missing. This results in an ever-increasing number of arguments. If I add a debug line like so: 

  def 

 (({def method_missing(sym, *args) 
    
   print "#{sym} #{args}\n" 
    
   foo(sym, *args) 
  
 end 

  

 bar # undefined method method})) 

 then this is the first few lines of output: 

  

 bar [] 
  
 foo [:bar] 
  
 foo [:foo, :bar] 
  
 foo [:foo, :foo, :bar] 
  
 foo [:foo, :foo, :foo, :bar] 

 The expected result is that it should report a SystemStackError 

  

 mm.rb:2: stack level too deep (SystemStackError) 

 The actual result is this: 

  mm.rb:2: [BUG] Segmentation fault 
  ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0] 
 
  -- Control frame information ----------------------------------------------- 
  c:2695 p:0037 s:10775 b:9428 l:009427 d:009427 METHOD thing.rb:3 
  c:2694 p:---- s:9423 b:9423 l:009422 d:009422 FINISH 
  c:2693 p:0037 s:9421 b:9421 l:009420 d:009420 METHOD thing.rb:3 
  c:2692 p:---- s:9416 b:9416 l:009415 d:009415 FINISH 

 That crash log goes on a lot longer and I will attach both the ruby crash log and the system crash log.

Back