From d2290cc82c398a75ea246ae101455539cb788382 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 30 Sep 2015 14:39:27 +0100 Subject: [PATCH 1/2] Sanity-check gossip messages --- router/gossip_channel.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/router/gossip_channel.go b/router/gossip_channel.go index ccf4aa9b..11e8e8aa 100644 --- a/router/gossip_channel.go +++ b/router/gossip_channel.go @@ -148,11 +148,18 @@ func (c *GossipChannel) gcSenders(connections ConnectionSet) { } } +// We have seen a couple of failures which suggest a >128GB slice was encountered. +// 100MB should be enough for anyone. +const maxFeasibleMessageLen = 100 * 1024 * 1024 + func (c *GossipChannel) sendDown(conn Connection, data GossipData) { sender, found := c.senders[conn] if !found { sender = NewGossipSender(func(pending GossipData) { for _, msg := range pending.Encode() { + if len(msg) > maxFeasibleMessageLen { + panic(fmt.Sprintf("Gossip message too large: len=%d bytes; on channel '%s' from %+v", len(msg), c.name, pending)) + } protocolMsg := ProtocolMsg{ProtocolGossip, GobEncode(c.name, c.ourself.Name, msg)} conn.(ProtocolSender).SendProtocolMsg(protocolMsg) } From db46204ff9d565b4e97acc3a040aa735714c3ea8 Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Wed, 30 Sep 2015 14:22:24 +0000 Subject: [PATCH 2/2] Disable 160_claim test. --- test/{160_claim_3_test.sh => 160_claim_3_test_disabled.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/{160_claim_3_test.sh => 160_claim_3_test_disabled.sh} (100%) diff --git a/test/160_claim_3_test.sh b/test/160_claim_3_test_disabled.sh similarity index 100% rename from test/160_claim_3_test.sh rename to test/160_claim_3_test_disabled.sh