Project

General

Profile

Actions

Backport #7402

closed

Avoid calling methods on user objects from segfault handler

Added by Anonymous over 11 years ago. Updated over 11 years ago.

Status:
Closed
[ruby-core:49573]

Description

When the segfault handler is listing loaded features, it iterates through $LOADED_FEATURES and calls StringValueCStr() on each item. This in turn calls #to_str on the object.

If a #to_str method is defined on a non-T_STRING, it is possible to have code run during the segfault handler. If an exception is raised or a tag is thrown, it is possible to escape the segfault handler and recover from a segmentation fault.

I've attached a patch that checks if an item in $LOADED_FEATURES is a T_STRING, and calls rb_any_to_s() if not. This will avoid calling any methods which could potentially call back into Ruby-land.


Files

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0