Skip to content
  • Takashi Kokubun's avatar
    745fe4cf
    merge revision(s) 660b9953: [Backport #20915] · 745fe4cf
    Takashi Kokubun authored
    	[Bug #20915] Fix SEGV with `TracePoint#parameters` and aliased C method
    
    	The following snippet results with a SEGV:
    
    	```ruby
    	C = Class.new do
    	  alias_method :new_to_s, :to_s
    	end
    
    	TracePoint.new(:c_call, &:parameters).enable { C.new.new_to_s }
    	```
    
    	at MRI 3.3.6 and ruby 3.4.0dev
    
    	The root cause of the issue lies in the `rb_tracearg_parameters` function
    	within the `RUBY_EVENT_C_RETURN` branch. Specifically, when the invoked
    	method is an alias for a C function,
    	`rb_method_entry_without_refinements(..., trace_arg->called_id, ...)`
    	may return NULL. In that case we can fallback to `trace_arg->id`.
    745fe4cf
    merge revision(s) 660b9953: [Backport #20915]
    Takashi Kokubun authored
    	[Bug #20915] Fix SEGV with `TracePoint#parameters` and aliased C method
    
    	The following snippet results with a SEGV:
    
    	```ruby
    	C = Class.new do
    	  alias_method :new_to_s, :to_s
    	end
    
    	TracePoint.new(:c_call, &:parameters).enable { C.new.new_to_s }
    	```
    
    	at MRI 3.3.6 and ruby 3.4.0dev
    
    	The root cause of the issue lies in the `rb_tracearg_parameters` function
    	within the `RUBY_EVENT_C_RETURN` branch. Specifically, when the invoked
    	method is an alias for a C function,
    	`rb_method_entry_without_refinements(..., trace_arg->called_id, ...)`
    	may return NULL. In that case we can fallback to `trace_arg->id`.
Loading