[ruby/openssl] Check if the option is an Hash in pkey_ctx_apply_options0()
causes SEGV if it is an Array or something like that. https://github.com/ruby/openssl/commit/ef23525210
This commit is contained in:
parent
c865e8d161
commit
a98096349e
@ -200,6 +200,7 @@ static VALUE
|
|||||||
pkey_ctx_apply_options0(VALUE args_v)
|
pkey_ctx_apply_options0(VALUE args_v)
|
||||||
{
|
{
|
||||||
VALUE *args = (VALUE *)args_v;
|
VALUE *args = (VALUE *)args_v;
|
||||||
|
Check_Type(args[1], T_HASH);
|
||||||
|
|
||||||
rb_block_call(args[1], rb_intern("each"), 0, NULL,
|
rb_block_call(args[1], rb_intern("each"), 0, NULL,
|
||||||
pkey_ctx_apply_options_i, args[0]);
|
pkey_ctx_apply_options_i, args[0]);
|
||||||
|
@ -108,6 +108,11 @@ class OpenSSL::TestPKeyRSA < OpenSSL::PKeyTestCase
|
|||||||
salt_length: 20, mgf1_hash: "SHA1")
|
salt_length: 20, mgf1_hash: "SHA1")
|
||||||
# Defaults to PKCS #1 v1.5 padding => verification failure
|
# Defaults to PKCS #1 v1.5 padding => verification failure
|
||||||
assert_equal false, key.verify("SHA256", sig_pss, data)
|
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
|
end
|
||||||
|
|
||||||
def test_sign_verify_raw
|
def test_sign_verify_raw
|
||||||
|
Loading…
x
Reference in New Issue
Block a user