aboutsummaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorZachary Scott <e@zzak.io>2015-06-03 13:55:06 -0400
committerZachary Scott <e@zzak.io>2015-06-03 13:55:06 -0400
commitbd594af66966d8ab62e6963540b2caabc0cf3087 (patch)
tree5556781d4fa77180410319b41bf456b45ffcc3e7 /ext
parent1d5b3b2f8c9a9ab19e8854ce103ef1f7298d1df7 (diff)
downloadruby-openssl-bd594af66966d8ab62e6963540b2caabc0cf3087.tar.gz
Upstream ruby/ruby@9fbf488 from r50646
Diffstat (limited to 'ext')
-rw-r--r--ext/openssl/ossl_asn1.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index 9d3775cf..069a024b 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -1029,7 +1029,7 @@ static VALUE
ossl_asn1_traverse(VALUE self, VALUE obj)
{
unsigned char *p;
- volatile VALUE tmp;
+ VALUE tmp;
long len, read = 0, offset = 0;
obj = ossl_to_der_if_possible(obj);
@@ -1037,6 +1037,7 @@ ossl_asn1_traverse(VALUE self, VALUE obj)
p = (unsigned char *)RSTRING_PTR(tmp);
len = RSTRING_LEN(tmp);
ossl_asn1_decode0(&p, len, &offset, 0, 1, &read);
+ RB_GC_GUARD(tmp);
int_ossl_decode_sanity_check(len, read, offset);
return Qnil;
}
@@ -1058,7 +1059,7 @@ ossl_asn1_decode(VALUE self, VALUE obj)
{
VALUE ret;
unsigned char *p;
- volatile VALUE tmp;
+ VALUE tmp;
long len, read = 0, offset = 0;
obj = ossl_to_der_if_possible(obj);
@@ -1066,6 +1067,7 @@ ossl_asn1_decode(VALUE self, VALUE obj)
p = (unsigned char *)RSTRING_PTR(tmp);
len = RSTRING_LEN(tmp);
ret = ossl_asn1_decode0(&p, len, &offset, 0, 0, &read);
+ RB_GC_GUARD(tmp);
int_ossl_decode_sanity_check(len, read, offset);
return ret;
}
@@ -1089,7 +1091,7 @@ ossl_asn1_decode_all(VALUE self, VALUE obj)
VALUE ary, val;
unsigned char *p;
long len, tmp_len = 0, read = 0, offset = 0;
- volatile VALUE tmp;
+ VALUE tmp;
obj = ossl_to_der_if_possible(obj);
tmp = rb_str_new4(StringValue(obj));
@@ -1104,6 +1106,7 @@ ossl_asn1_decode_all(VALUE self, VALUE obj)
read += tmp_read;
tmp_len -= tmp_read;
}
+ RB_GC_GUARD(tmp);
int_ossl_decode_sanity_check(len, read, offset);
return ary;
}