summaryrefslogtreecommitdiff
path: root/test/openssl
diff options
context:
space:
mode:
authoremboss <emboss@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-22 21:34:28 +0000
committeremboss <emboss@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-22 21:34:28 +0000
commita65d506d83ee126d59576e483bdb6699ec73bbe7 (patch)
tree17e7eec0e75a3ff8344ee709867628dde296d2f0 /test/openssl
parente7d04f4b82a96bcda5224c75314e1dcf93f5f277 (diff)
* 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
Diffstat (limited to 'test/openssl')
-rw-r--r--test/openssl/test_asn1.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/openssl/test_asn1.rb b/test/openssl/test_asn1.rb
index e29bf438b9..94083f86e4 100644
--- a/test/openssl/test_asn1.rb
+++ b/test/openssl/test_asn1.rb
@@ -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),