From dc99dd391f4ee1642bd2a3502bfe9d5fd1fc0932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Wed, 10 Jul 2024 22:46:33 +0200 Subject: [PATCH] src: fix error handling in ExportJWKAsymmetricKey Because call sites check IsNothing() on the return value of ExportJWKAsymmetricKey() and ignore the boolean value if the return value is Just (i.e., not nothing), this function must return Nothing() instead of Just(false) when throwing a JavaScript error. PR-URL: https://github.com/nodejs/node/pull/53767 Reviewed-By: Filip Skokan Reviewed-By: Yagiz Nizipli Reviewed-By: James M Snell --- src/crypto/crypto_keys.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc index db03387d42c816..bb0541310e7e97 100644 --- a/src/crypto/crypto_keys.cc +++ b/src/crypto/crypto_keys.cc @@ -505,7 +505,7 @@ Maybe ExportJWKAsymmetricKey( case EVP_PKEY_X448: return ExportJWKEdKey(env, key, target); } THROW_ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE(env); - return Just(false); + return Nothing(); } std::shared_ptr ImportJWKAsymmetricKey(