diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-21 05:03:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-21 05:03:55 +0000 |
commit | d892fd4b2d522b7e796a84f17ef245e7931d3138 (patch) | |
tree | d9f27b2f550c19c5e33a93f0ab98b98a664e5fe4 /ext | |
parent | e794611a1f60152491fe40511a3afc16181ebd30 (diff) | |
download | ruby-d892fd4b2d522b7e796a84f17ef245e7931d3138.tar.gz |
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
Diffstat (limited to 'ext')
-rw-r--r-- | ext/digest/digest.c | 3 |
1 files changed, 3 insertions, 0 deletions
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; } |