From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, URIBL_BLOCKED shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: kgio-public@bogomips.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 829451FDF2; Fri, 9 Jan 2015 02:10:30 +0000 (UTC) Date: Fri, 9 Jan 2015 02:10:30 +0000 From: Eric Wong To: Petr Novodvorskiy Cc: kgio-public@bogomips.org, Lara Martin , Nick Astete Subject: [PATCH] tryopen: add RB_GC_GUARD for Ruby 1.8 Message-ID: <20150109021030.GA21851@dcvr.yhbt.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: Hi Petr, I haven't heard from you, but I'm nearly certain adding one RB_GC_GUARD will solve your problem and will push out the following patch, thanks. --------------------------8<---------------------------- From: Eric Wong Subject: [PATCH] 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); } -- EW