summaryrefslogtreecommitdiff
path: root/ext/digest
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-21 05:03:55 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-21 05:03:55 (GMT)
commitac9d6b050b6a475a3a6a683390a08a693e5835fa (patch)
treed9f27b2f550c19c5e33a93f0ab98b98a664e5fe4 /ext/digest
parent8147bd1e491718521bea4aa97fe98010dbbb6625 (diff)
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/digest')
-rw-r--r--ext/digest/digest.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/digest/digest.c b/ext/digest/digest.c
index 239fe7c..a02eb12 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;
}