aboutsummaryrefslogtreecommitdiff
path: root/src/blockencodings.h
diff options
context:
space:
mode:
authorKaz Wesley <kaz@lambdaverse.org>2018-11-13 12:40:22 -0800
committerKaz Wesley <kaz@lambdaverse.org>2018-11-13 12:41:41 -0800
commitb08af10fb299dc3fdcd1f022619fb112c72e5d8e (patch)
tree304484e3afe39caca10281baf70e3f4e66a9490c /src/blockencodings.h
parent6bed4b374daf26233e96fa7863d4324a5bfa99c2 (diff)
disallow oversized CBlockHeaderAndShortTxIDs
Otherwise we'd reply with a bogus BlockTransactionsRequest trying to request indexes with overflowed deltas.
Diffstat (limited to 'src/blockencodings.h')
-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();
}