Skip to content

Commit 220a3e9

Browse files
authored
Merge pull request #50 from TheBlueMatt/master
Fix channelmonitor fuzz test failure
2 parents 155f2ef + 4f644f2 commit 220a3e9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/ln/channelmonitor.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,14 @@ impl ChannelMonitor {
770770
() => {
771771
{
772772
let tx_len = byte_utils::slice_to_be64(read_bytes!(8));
773-
let tx: Transaction = unwrap_obj!(serialize::deserialize(read_bytes!(tx_len)));
773+
let tx_ser = read_bytes!(tx_len);
774+
let tx: Transaction = unwrap_obj!(serialize::deserialize(tx_ser));
775+
if serialize::serialize(&tx).unwrap() != tx_ser {
776+
// We check that the tx re-serializes to the same form to ensure there is
777+
// no extra data, and as rust-bitcoin doesn't handle the 0-input ambiguity
778+
// all that well.
779+
return None;
780+
}
774781

775782
let revocation_key = unwrap_obj!(PublicKey::from_slice(&secp_ctx, read_bytes!(33)));
776783
let a_htlc_key = unwrap_obj!(PublicKey::from_slice(&secp_ctx, read_bytes!(33)));

0 commit comments

Comments
 (0)