From 70e463c2948b61fc6dcdfd483e27ab711c6a84f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Thu, 21 Feb 2019 12:46:49 +0100 Subject: [PATCH] crypto: fix error condition in Verify::VerifyFinal Fail early if key parsing failed, don't try to construct a context out of it. PR-URL: https://github.com/nodejs/node/pull/26238 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis --- src/node_crypto.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 56900851238..739c52f46e2 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -4648,6 +4648,8 @@ void Verify::VerifyFinal(const FunctionCallbackInfo& args) { unsigned int offset = 0; ManagedEVPPKey pkey = GetPublicOrPrivateKeyFromJs(args, &offset, true); + if (!pkey) + return; char* hbuf = Buffer::Data(args[offset]); ssize_t hlen = Buffer::Length(args[offset]);