mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/openssl/ossl_asn1.c: Forbid Constructive without infinite
length. This also prevents a segfault. Added test and improved documentation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e7d04f4b82
commit
a65d506d83
3 changed files with 23 additions and 0 deletions
|
@ -243,6 +243,17 @@ class OpenSSL::TestASN1 < Test::Unit::TestCase
|
|||
assert_equal(raw, asn1.to_der)
|
||||
end
|
||||
|
||||
def test_cons_without_inf_length_forbidden
|
||||
assert_raise(OpenSSL::ASN1::ASN1Error) do
|
||||
val = OpenSSL::ASN1::OctetString.new('a')
|
||||
cons = OpenSSL::ASN1::Constructive.new([val],
|
||||
OpenSSL::ASN1::OCTET_STRING,
|
||||
nil,
|
||||
:UNIVERSAL)
|
||||
cons.to_der
|
||||
end
|
||||
end
|
||||
|
||||
def test_seq_infinite_length
|
||||
begin
|
||||
content = [ OpenSSL::ASN1::Null.new(nil),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue