Skip to content

Commit c9c21cf

Browse files
authored
Merge pull request #1416 from apoelstra/2025-02--psbt-fix
pset: fix NULL pointer dereference when deserializing malformed PSETs over RPC
2 parents e343610 + 0bff9b0 commit c9c21cf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/psbt.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -901,12 +901,16 @@ struct PSBTInput
901901
Sidechain::Bitcoin::CTransactionRef tx;
902902
OverrideStream<Stream> os(&s, s.GetType(), s.GetVersion());
903903
UnserializeFromVector(os, tx);
904-
m_peg_in_tx = tx;
904+
if (tx) {
905+
m_peg_in_tx = tx;
906+
}
905907
} else {
906908
CTransactionRef tx;
907909
OverrideStream<Stream> os(&s, s.GetType(), s.GetVersion());
908910
UnserializeFromVector(os, tx);
909-
m_peg_in_tx = tx;
911+
if (tx) {
912+
m_peg_in_tx = tx;
913+
}
910914
}
911915
break;
912916
}
@@ -1091,9 +1095,9 @@ struct PSBTInput
10911095
} else if (subkey_len != 1) {
10921096
throw std::ios_base::failure("Input issuance needs blinded flag is more than one byte type");
10931097
}
1094-
bool b;
1098+
uint8_t b;
10951099
UnserializeFromVector(s, b);
1096-
m_blinded_issuance = b;
1100+
m_blinded_issuance = !!b;
10971101
break;
10981102
}
10991103
default:

0 commit comments

Comments
 (0)