Fix 2 subscript[0] bugs in pubkey.cpp, and eliminate one extra size check
This commit is contained in:
parent
e0451e3e2a
commit
500710bd29
1 changed files with 2 additions and 5 deletions
|
@ -172,10 +172,7 @@ bool CPubKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchS
|
||||||
if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, &(*this)[0], size())) {
|
if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, &(*this)[0], size())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (vchSig.size() == 0) {
|
if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, vchSig.data(), vchSig.size())) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, &vchSig[0], vchSig.size())) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/* libsecp256k1's ECDSA verification requires lower-S signatures, which have
|
/* libsecp256k1's ECDSA verification requires lower-S signatures, which have
|
||||||
|
@ -274,7 +271,7 @@ bool CExtPubKey::Derive(CExtPubKey &out, unsigned int _nChild) const {
|
||||||
|
|
||||||
/* static */ bool CPubKey::CheckLowS(const std::vector<unsigned char>& vchSig) {
|
/* static */ bool CPubKey::CheckLowS(const std::vector<unsigned char>& vchSig) {
|
||||||
secp256k1_ecdsa_signature sig;
|
secp256k1_ecdsa_signature sig;
|
||||||
if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, &vchSig[0], vchSig.size())) {
|
if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, vchSig.data(), vchSig.size())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (!secp256k1_ecdsa_signature_normalize(secp256k1_context_verify, NULL, &sig));
|
return (!secp256k1_ecdsa_signature_normalize(secp256k1_context_verify, NULL, &sig));
|
||||||
|
|
Loading…
Add table
Reference in a new issue