ruby-changes:38499
From: nobu <ko1@a...>
Date: Thu, 21 May 2015 14:04:56 +0900 (JST)
Subject: [ruby-changes:38499] nobu:r50580 (trunk): digest.c: GC guard
nobu 2015-05-21 14:03:55 +0900 (Thu, 21 May 2015) New Revision: 50580 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50580 Log: digest.c: GC guard * ext/digest/digest.c (hexencode_str_new, rb_digest_base_update): prevent argument strings from GC. Modified files: trunk/ext/digest/digest.c Index: ext/digest/digest.c =================================================================== --- ext/digest/digest.c (revision 50579) +++ ext/digest/digest.c (revision 50580) @@ -124,6 +124,8 @@ hexencode_str_new(VALUE str_digest) https://github.com/ruby/ruby/blob/trunk/ext/digest/digest.c#L124 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 https://github.com/ruby/ruby/blob/trunk/ext/digest/digest.c#L625 StringValue(str); algo->update_func(pctx, (unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str)); + RB_GC_GUARD(str); return self; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/