summaryrefslogtreecommitdiff
path: root/test/openssl/test_asn1.rb
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-26 08:17:01 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-26 08:17:01 +0000
commit0522ffd51f03afb615fc70844e25905da31b96f8 (patch)
tree1db889bf8a8365555d04f3b06fa75c376d37049f /test/openssl/test_asn1.rb
parent12893215b5330dc74f30a0f9dff28b1a5463d25a (diff)
* ext/openssl/ossl_asn1.c (ossl_asn1_decode0): OpenSSL::ASN1.decode
should reject indefinite length primitive encodings as that is illegal. Patch by Martin Bosslet. See #4324. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/openssl/test_asn1.rb')
-rw-r--r--test/openssl/test_asn1.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/openssl/test_asn1.rb b/test/openssl/test_asn1.rb
index bdd4f88719e..4fd4771d7b2 100644
--- a/test/openssl/test_asn1.rb
+++ b/test/openssl/test_asn1.rb
@@ -430,4 +430,14 @@ class OpenSSL::TestASN1 < Test::Unit::TestCase
end
end
+ def test_primitive_inf_length
+ assert_raises(OpenSSL::ASN1::ASN1Error) do
+ spec = %w{ 02 80 02 01 01 00 00 }
+ raw = [spec.join('')].pack('H*')
+ OpenSSL::ASN1.decode(raw)
+ OpenSSL::ASN1.decode_all(raw)
+ end
+ end
+
end if defined?(OpenSSL)
+