* ext/openssl/ossl_asn1.c (ossl_asn1_decode_all): use rb_str_new4
to avoid SEGV. * ext/openssl/ossl_asn1.c (ossl_asn1_traverse, ossl_asn1_decode, ossl_asn1_decode_all): temporary value should be marked volatile. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
21d42dc45b
commit
8180c1bd50
@ -1,3 +1,11 @@
|
|||||||
|
Tue Dec 21 22:07:41 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||||
|
|
||||||
|
* ext/openssl/ossl_asn1.c (ossl_asn1_decode_all): use rb_str_new4
|
||||||
|
to avoid SEGV.
|
||||||
|
|
||||||
|
* ext/openssl/ossl_asn1.c (ossl_asn1_traverse, ossl_asn1_decode,
|
||||||
|
ossl_asn1_decode_all): temporary value should be marked volatile.
|
||||||
|
|
||||||
Tue Dec 21 12:42:34 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
Tue Dec 21 12:42:34 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||||
|
|
||||||
* ext/openssl/ossl_asn1.c (ossl_asn1_traverse, ossl_asn1_decode):
|
* ext/openssl/ossl_asn1.c (ossl_asn1_traverse, ossl_asn1_decode):
|
||||||
|
@ -813,11 +813,12 @@ ossl_asn1_traverse(VALUE self, VALUE obj)
|
|||||||
{
|
{
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
|
volatile VALUE tmp;
|
||||||
|
|
||||||
obj = ossl_to_der_if_possible(obj);
|
obj = ossl_to_der_if_possible(obj);
|
||||||
obj = rb_str_new4(StringValue(obj));
|
tmp = rb_str_new4(StringValue(obj));
|
||||||
p = RSTRING(obj)->ptr;
|
p = RSTRING(tmp)->ptr;
|
||||||
ossl_asn1_decode0(&p, RSTRING(obj)->len, &offset, 0, 0, 1);
|
ossl_asn1_decode0(&p, RSTRING(tmp)->len, &offset, 0, 0, 1);
|
||||||
|
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
@ -828,11 +829,12 @@ ossl_asn1_decode(VALUE self, VALUE obj)
|
|||||||
VALUE ret, ary;
|
VALUE ret, ary;
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
|
volatile VALUE tmp;
|
||||||
|
|
||||||
obj = ossl_to_der_if_possible(obj);
|
obj = ossl_to_der_if_possible(obj);
|
||||||
obj = rb_str_new4(StringValue(obj));
|
tmp = rb_str_new4(StringValue(obj));
|
||||||
p = RSTRING(obj)->ptr;
|
p = RSTRING(tmp)->ptr;
|
||||||
ary = ossl_asn1_decode0(&p, RSTRING(obj)->len, &offset, 0, 1, 0);
|
ary = ossl_asn1_decode0(&p, RSTRING(tmp)->len, &offset, 0, 1, 0);
|
||||||
ret = rb_ary_entry(ary, 0);
|
ret = rb_ary_entry(ary, 0);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -844,11 +846,12 @@ ossl_asn1_decode_all(VALUE self, VALUE obj)
|
|||||||
VALUE ret;
|
VALUE ret;
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
|
volatile VALUE tmp;
|
||||||
|
|
||||||
obj = ossl_to_der_if_possible(obj);
|
obj = ossl_to_der_if_possible(obj);
|
||||||
StringValue(obj);
|
tmp = rb_str_new4(StringValue(obj));
|
||||||
p = RSTRING(obj)->ptr;
|
p = RSTRING(tmp)->ptr;
|
||||||
ret = ossl_asn1_decode0(&p, RSTRING(obj)->len, &offset, 0, 0, 0);
|
ret = ossl_asn1_decode0(&p, RSTRING(tmp)->len, &offset, 0, 0, 0);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user