summaryrefslogtreecommitdiff
path: root/test/openssl
diff options
context:
space:
mode:
authorNobuhiro IMAI <nov@yo.rim.or.jp>2020-09-29 00:05:36 +0900
committerKazuki Yamaguchi <k@rhe.jp>2021-10-16 18:34:35 +0900
commitf88401f38e918c0bdc4d7c6b22f25e0a7eef04bb (patch)
tree38100f91d12133ee67c0fdd953a49538cc51caa4 /test/openssl
parent6dcc74155f8b2951b7fed55cafae9cd27a73f090 (diff)
[ruby/openssl] fix segv in Timestamp::{Request,Response,TokenInfo}.new
prevent `ossl_ts_*_free()` from calling when `d2i_TS_*_bio()` failed. https://github.com/ruby/openssl/commit/b29e215786
Diffstat (limited to 'test/openssl')
-rw-r--r--test/openssl/test_ts.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/openssl/test_ts.rb b/test/openssl/test_ts.rb
index 8e31a7d28d..7cb1a1fe8e 100644
--- a/test/openssl/test_ts.rb
+++ b/test/openssl/test_ts.rb
@@ -181,6 +181,12 @@ _end_of_pem_
assert_equal(42, qer2.nonce)
end
+ def test_request_invalid_asn1
+ assert_raise(OpenSSL::Timestamp::TimestampError) do
+ OpenSSL::Timestamp::Request.new("*" * 44)
+ end
+ end
+
def test_response_constants
assert_equal(0, OpenSSL::Timestamp::Response::GRANTED)
assert_equal(1, OpenSSL::Timestamp::Response::GRANTED_WITH_MODS)
@@ -338,6 +344,12 @@ _end_of_pem_
end
end
+ def test_response_invalid_asn1
+ assert_raise(OpenSSL::Timestamp::TimestampError) do
+ OpenSSL::Timestamp::Response.new("*" * 44)
+ end
+ end
+
def test_no_cert_requested
req = OpenSSL::Timestamp::Request.new
req.algorithm = "SHA1"
@@ -590,6 +602,12 @@ _end_of_pem_
assert_equal(123, info.nonce)
end
+ def test_token_info_invalid_asn1
+ assert_raise(OpenSSL::Timestamp::TimestampError) do
+ OpenSSL::Timestamp::TokenInfo.new("*" * 44)
+ end
+ end
+
private
def assert_cert expected, actual