summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_asn1.c
diff options
context:
space:
mode:
authorMichael Leibowitz <michael.leibowitz@intel.com>2013-08-15 15:02:54 -0700
committerMichael Leibowitz <michael.leibowitz@intel.com>2013-08-15 15:02:54 -0700
commit6b0e2a11aeccf2ebc707c22548a0c15c8c2bae06 (patch)
treed9d59f4b502927634d32832e963db76629ff5a2e /ext/openssl/ossl_asn1.c
parent3b35de2a90e26b99e2a6d4f61dc56d6ce7ded748 (diff)
downloadruby-upstream.tar.gz
ruby-upstream.tar.bz2
ruby-upstream.zip
Imported Upstream version 1.9.3.p448upstream/1.9.3.p448upstream
Diffstat (limited to 'ext/openssl/ossl_asn1.c')
-rw-r--r--ext/openssl/ossl_asn1.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index 2a50b75..3cc2645 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_asn1.c 34505 2012-02-09 03:25:07Z nobu $
+ * $Id: ossl_asn1.c 39980 2013-03-28 09:19:07Z usa $
* 'OpenSSL for Ruby' team members
* Copyright (C) 2003
* All rights reserved.
@@ -149,11 +149,16 @@ num_to_asn1integer(VALUE obj, ASN1_INTEGER *ai)
ASN1_INTEGER *
num_to_asn1integer(VALUE obj, ASN1_INTEGER *ai)
{
- BIGNUM *bn = GetBNPtr(obj);
+ BIGNUM *bn;
+
+ if (NIL_P(obj))
+ ossl_raise(rb_eTypeError, "Can't convert nil into Integer");
- if (!(ai = BN_to_ASN1_INTEGER(bn, ai))) {
+ bn = GetBNPtr(obj);
+
+ if (!(ai = BN_to_ASN1_INTEGER(bn, ai)))
ossl_raise(eOSSLError, NULL);
- }
+
return ai;
}
#endif
@@ -219,6 +224,9 @@ static ID sivVALUE, sivTAG, sivTAG_CLASS, sivTAGGING, sivINFINITE_LENGTH, sivUNU
static ASN1_BOOLEAN
obj_to_asn1bool(VALUE obj)
{
+ if (NIL_P(obj))
+ ossl_raise(rb_eTypeError, "Can't convert nil into Boolean");
+
#if OPENSSL_VERSION_NUMBER < 0x00907000L
return RTEST(obj) ? 0xff : 0x100;
#else