Skip to content

Commit ce7fcc3

Browse files
committed
Merge #14690: Throw error if CPubKey is invalid during PSBT keypath serialization
4e4de10 Throw error if CPubKey is invalid during PSBT keypath serialization (Gregory Sanders) Pull request description: Related to bitcoin/bitcoin#14689 We should catch this error before attempting to deserialize it later. Tree-SHA512: d2f3ea7f363818ac70c81ee988231b2bb50d055b6919f7bff3f27120c85a7048bfa183efae33e23e6b81d684bcb8bb81e5b209abb3acbcaff1d88014f4f1aa93
2 parents 083f535 + 4e4de10 commit ce7fcc3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/script/sign.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ template<typename Stream>
206206
void SerializeHDKeypaths(Stream& s, const std::map<CPubKey, KeyOriginInfo>& hd_keypaths, uint8_t type)
207207
{
208208
for (auto keypath_pair : hd_keypaths) {
209+
if (!keypath_pair.first.IsValid()) {
210+
throw std::ios_base::failure("Invalid CPubKey being serialized");
211+
}
209212
SerializeToVector(s, type, MakeSpan(keypath_pair.first));
210213
WriteCompactSize(s, (keypath_pair.second.path.size() + 1) * sizeof(uint32_t));
211214
s << keypath_pair.second.fingerprint;

0 commit comments

Comments
 (0)