Skip to content

Commit

Permalink
Throw error if CPubKey is invalid during PSBT keypath serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
instagibbs committed Nov 8, 2018
1 parent 6b8d0a2 commit 4e4de10
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/script/sign.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4e4de10

Please sign in to comment.