From ac9d6b050b6a475a3a6a683390a08a693e5835fa Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 21 May 2015 05:03:55 +0000 Subject: digest.c: GC guard * ext/digest/digest.c (hexencode_str_new, rb_digest_base_update): prevent argument strings from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/digest/digest.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ext/digest') diff --git a/ext/digest/digest.c b/ext/digest/digest.c index 239fe7cb10..a02eb12cd6 100644 --- a/ext/digest/digest.c +++ b/ext/digest/digest.c @@ -124,6 +124,8 @@ hexencode_str_new(VALUE str_digest) p[i + i + 1] = hex[byte & 0x0f]; } + RB_GC_GUARD(str_digest); + return str; } @@ -623,6 +625,7 @@ rb_digest_base_update(VALUE self, VALUE str) StringValue(str); algo->update_func(pctx, (unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str)); + RB_GC_GUARD(str); return self; } -- cgit v1.2.3