From 91e1332011ca647362f95f34ae6c530640bfef98 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Sat, 10 Jan 2015 09:14:17 +0100 Subject: [PATCH] fail immediately on an empty signature Github-Pull: #5634 Rebased-From: 8dccba6a45db0466370726ed462b9da2eae43bce --- src/key.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/key.cpp b/src/key.cpp index 8a1bfef771a..7fcb17d574f 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -376,6 +376,9 @@ bool CKey::SetCompactSignature(uint256 hash, const std::vector& v bool CKey::Verify(uint256 hash, const std::vector& vchSig) { + if (vchSig.empty()) + return false; + // New versions of OpenSSL will reject non-canonical DER signatures. de/re-serialize first. unsigned char *norm_der = NULL; ECDSA_SIG *norm_sig = ECDSA_SIG_new();