kgio RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: Petr Novodvorskiy <nidd@skytap.com>
Cc: kgio-public@bogomips.org, Lara Martin <lmartin@skytap.com>,
	Nick Astete <nastete@skytap.com>
Subject: [PATCH] tryopen: add RB_GC_GUARD for Ruby 1.8
Date: Fri, 9 Jan 2015 02:10:30 +0000	[thread overview]
Message-ID: <20150109021030.GA21851@dcvr.yhbt.net> (raw)
In-Reply-To: <CAHGF7iJk9-wK5WbSiAgQaRye7y2RJttLBpykRBpnKkxFi=ASHg@mail.gmail.com>

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 <e@80x24.org>
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: <CAHGF7iJk9-wK5WbSiAgQaRye7y2RJttLBpykRBpnKkxFi=ASHg@mail.gmail.com>
Cc: Petr Novodvorskiy <nidd@skytap.com>
Cc: Lara Martin <lmartin@skytap.com>
Cc: Nick Astete <nastete@skytap.com>
---
 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


      parent reply	other threads:[~2015-01-09  2:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-30  7:00 programs using kgio crash under memory pressure during init Petr Novodvorskiy
2014-12-30  7:22 ` Eric Wong
2014-12-30  7:40 ` Hleb Valoshka
2015-01-06  3:11 ` Eric Wong
2015-01-09  2:10 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/kgio/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150109021030.GA21851@dcvr.yhbt.net \
    --to=e@80x24.org \
    --cc=kgio-public@bogomips.org \
    --cc=lmartin@skytap.com \
    --cc=nastete@skytap.com \
    --cc=nidd@skytap.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/kgio.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).