about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-01-09 01:47:18 +0000
committerEric Wong <e@80x24.org>2015-01-09 02:08:08 +0000
commita818db828b3cdaae04376a64bc6800a770b0c4cb (patch)
tree26d300a02be52d990285574baa335214be777113
parentdf570e817dbb8afc42efd05521b29d836fe11736 (diff)
downloadkgio-a818db828b3cdaae04376a64bc6800a770b0c4cb.tar.gz
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>
-rw-r--r--ext/kgio/tryopen.c1
1 files changed, 1 insertions, 0 deletions
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);
 }