From a818db828b3cdaae04376a64bc6800a770b0c4cb Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 9 Jan 2015 01:47:18 +0000 Subject: tryopen: add RB_GC_GUARD for Ruby 1.8 Calling rb_intern(RSTRING_PTR(err)) was unsafe as the `err' value could be GC-ed inside rb_intern. This only affected Ruby 1.8 as Errno.constants returns an array of Symbols under 1.9+ Thanks to Petr Novodvorskiy for reporting the issue. ref: Cc: Petr Novodvorskiy Cc: Lara Martin Cc: Nick Astete --- ext/kgio/tryopen.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/kgio/tryopen.c b/ext/kgio/tryopen.c index 20f3f6d..d87cb17 100644 --- a/ext/kgio/tryopen.c +++ b/ext/kgio/tryopen.c @@ -194,4 +194,5 @@ void init_kgio_tryopen(void) ID2SYM(const_id)); } } + RB_GC_GUARD(tmp); } -- cgit v1.2.3-24-ge0c7