1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2014-04-24 02:53:29 +00:00
parent 34c35bf107
commit e923de6d4a
2 changed files with 7 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Thu Apr 24 11:53:28 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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]
Thu Apr 24 11:21:37 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (rb_sym2id, rb_sym2id_without_pindown): return 0 for

View file

@ -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{