From b32fa3ce1a0dca77369cce4f2f6c16f4c3c850ac 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. --- src/node_crypto.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index fcc35ce63fdd9a..8b6587b6eae885 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -4675,6 +4675,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]);