aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-11-13 13:43:52 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2018-11-13 13:44:09 +0100
commitce7fcc3569097b641a91126de1e6051654eb88f9 (patch)
tree43578f280592232b00526b6181032b64bc7bcb45 /src/script
parent083f5354709299a63516a56927fd82796d705027 (diff)
parent4e4de10f69d5d705256cadfb15d76314dff16e77 (diff)
downloadbitcoin-ce7fcc3569097b641a91126de1e6051654eb88f9.tar.xz
Merge #14690: Throw error if CPubKey is invalid during PSBT keypath serialization
4e4de10f69d5d705256cadfb15d76314dff16e77 Throw error if CPubKey is invalid during PSBT keypath serialization (Gregory Sanders) Pull request description: Related to https://github.com/bitcoin/bitcoin/pull/14689 We should catch this error before attempting to deserialize it later. Tree-SHA512: d2f3ea7f363818ac70c81ee988231b2bb50d055b6919f7bff3f27120c85a7048bfa183efae33e23e6b81d684bcb8bb81e5b209abb3acbcaff1d88014f4f1aa93
Diffstat (limited to 'src/script')
-rw-r--r--src/script/sign.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/script/sign.h b/src/script/sign.h
index e71f43f96d..a478f49789 100644
--- a/src/script/sign.h
+++ b/src/script/sign.h
@@ -206,6 +206,9 @@ template<typename Stream>
void SerializeHDKeypaths(Stream& s, const std::map<CPubKey, KeyOriginInfo>& hd_keypaths, uint8_t type)
{
for (auto keypath_pair : hd_keypaths) {
+ if (!keypath_pair.first.IsValid()) {
+ throw std::ios_base::failure("Invalid CPubKey being serialized");
+ }
SerializeToVector(s, type, MakeSpan(keypath_pair.first));
WriteCompactSize(s, (keypath_pair.second.path.size() + 1) * sizeof(uint32_t));
s << keypath_pair.second.fingerprint;