aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNobuhiro IMAI <nov@yo.rim.or.jp>2022-08-05 18:42:06 +0900
committerNobuhiro IMAI <nov@yo.rim.or.jp>2022-08-08 18:37:49 +0900
commitef2352521089998842672106d2c988387ffb6698 (patch)
tree7bac4e2ed1e19fe0eee10f07ca1b23506981351b /test
parentee64d93cb20e7fca80eddbf711c56ae2fac9a825 (diff)
downloadruby-openssl-ef2352521089998842672106d2c988387ffb6698.tar.gz
Check if the option is an Hash in `pkey_ctx_apply_options0()`
causes SEGV if it is an Array or something like that.
Diffstat (limited to 'test')
-rw-r--r--test/openssl/test_pkey_rsa.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/openssl/test_pkey_rsa.rb b/test/openssl/test_pkey_rsa.rb
index 4bb39ed4..fa84b76f 100644
--- a/test/openssl/test_pkey_rsa.rb
+++ b/test/openssl/test_pkey_rsa.rb
@@ -108,6 +108,11 @@ class OpenSSL::TestPKeyRSA < OpenSSL::PKeyTestCase
salt_length: 20, mgf1_hash: "SHA1")
# Defaults to PKCS #1 v1.5 padding => verification failure
assert_equal false, key.verify("SHA256", sig_pss, data)
+
+ # option type check
+ assert_raise_with_message(TypeError, /expected Hash/) {
+ key.sign("SHA256", data, ["x"])
+ }
end
def test_sign_verify_raw