aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaz Wesley <kaz@lambdaverse.org>2018-11-13 12:40:22 -0800
committerMarcoFalke <falke.marco@gmail.com>2018-11-28 15:35:05 -0500
commit2f9fd2932164eb86005e91cffcc66d2d79322db0 (patch)
tree954aa0c9eb715e0a6f056b8824525a9df5ffb6e2
parent5331ad0506fa1e13a70613309532588b2cc74bb5 (diff)
downloadbitcoin-2f9fd2932164eb86005e91cffcc66d2d79322db0.tar.xz
disallow oversized CBlockHeaderAndShortTxIDs
Otherwise we'd reply with a bogus BlockTransactionsRequest trying to request indexes with overflowed deltas. Github-Pull: #14685 Rebased-From: b08af10fb299dc3fdcd1f022619fb112c72e5d8e
-rw-r--r--src/blockencodings.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/blockencodings.h b/src/blockencodings.h
index 4bfe538250..0c2b83ebcf 100644
--- a/src/blockencodings.h
+++ b/src/blockencodings.h
@@ -186,6 +186,9 @@ public:
READWRITE(prefilledtxn);
+ if (BlockTxCount() > std::numeric_limits<uint16_t>::max())
+ throw std::ios_base::failure("indexes overflowed 16 bits");
+
if (ser_action.ForRead())
FillShortTxIDSelector();
}