summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@ruby-lang.org>2014-04-24 02:53:29 +0000
committernobu <nobu@ruby-lang.org>2014-04-24 02:53:29 +0000
commit53d9a420874cfa462b3a9cc921bd8fa787c7fa85 (patch)
treefb80fa504433ce33e2c4816066bdf3d6dd8ae994 /ext
parentea61f90042b55eb4d2c7780b8746a509a483b9dc (diff)
downloadruby-openssl-history-53d9a420874cfa462b3a9cc921bd8fa787c7fa85.tar.gz
ossl_asn1.c: fix undefined behavior
* ext/openssl/ossl_asn1.c (ossl_asn1_initialize): SYMID on a value other than Symbol is an undefined behavior. fix up r31699. [ruby-core:62142] [Bug #9771] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/openssl/ossl_asn1.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index c2344af..efdfbfc 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -1150,7 +1150,7 @@ ossl_asn1_initialize(int argc, VALUE *argv, VALUE self)
}
if(!SYMBOL_P(tag_class))
ossl_raise(eASN1Error, "invalid tag class");
- if(SYM2ID(tagging) == sIMPLICIT && NUM2INT(tag) > 31)
+ if(!NIL_P(tagging) && SYM2ID(tagging) == sIMPLICIT && NUM2INT(tag) > 31)
ossl_raise(eASN1Error, "tag number for Universal too large");
}
else{