From e117c0f86ccb5046fbd59d1b4ff37bbc06d2d0c0 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Mon, 31 Jan 2022 16:29:42 -0500 Subject: [PATCH] crypto: check return code from EVP_DigestUpdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Coverity was complaining that we did not check the return code. We seem to check in the other place it is called and the method already handles returning a result. Signed-off-by: Michael Dawson PR-URL: https://github.com/nodejs/node/pull/41800 Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Filip Skokan --- src/crypto/crypto_hash.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/crypto/crypto_hash.cc b/src/crypto/crypto_hash.cc index e4c4fc61815a1f..9aa9c604da7dc1 100644 --- a/src/crypto/crypto_hash.cc +++ b/src/crypto/crypto_hash.cc @@ -122,8 +122,7 @@ bool Hash::HashInit(const EVP_MD* md, Maybe xof_md_len) { bool Hash::HashUpdate(const char* data, size_t len) { if (!mdctx_) return false; - EVP_DigestUpdate(mdctx_.get(), data, len); - return true; + return EVP_DigestUpdate(mdctx_.get(), data, len) == 1; } void Hash::HashUpdate(const FunctionCallbackInfo& args) {