summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authoremboss <emboss@ruby-lang.org>2011-05-22 22:00:24 +0000
committeremboss <emboss@ruby-lang.org>2011-05-22 22:00:24 +0000
commit992c85a79d7f855d8232f31972f57702a4bbf919 (patch)
treee09fe6e6b4c883ae58499407ecbb1262e7d8c8fe /test
parent6602e8e0ed32f9c95571495b6418ae54c7caa898 (diff)
downloadruby-openssl-history-992c85a79d7f855d8232f31972f57702a4bbf919.tar.gz
* ext/openssl/ossl_asn1.c: Forbid Constructives whose value is not an
Array to prevent segfault. Added test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/test_asn1.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test_asn1.rb b/test/test_asn1.rb
index 94083f8..0122e0f 100644
--- a/test/test_asn1.rb
+++ b/test/test_asn1.rb
@@ -254,6 +254,18 @@ class OpenSSL::TestASN1 < Test::Unit::TestCase
end
end
+ def test_cons_without_array_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.infinite_length = true
+ cons.to_der
+ end
+ end
+
def test_seq_infinite_length
begin
content = [ OpenSSL::ASN1::Null.new(nil),