Skip to content

Commit 4e4de10

Browse files
committed
Throw error if CPubKey is invalid during PSBT keypath serialization
1 parent 6b8d0a2 commit 4e4de10

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)