diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-11-28 15:57:47 -0500 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-11-28 15:58:18 -0500 |
commit | 9f556622c57d3f7a0fdc8e3807fd798ee4b5a2fe (patch) | |
tree | 6d1bce64f12a47f4a301c7e63b0904a31814eadf /src/blockencodings.h | |
parent | 5150accdd2a7c7f0edf964d56bd7d34b5f740cdc (diff) | |
parent | 542651cfb408d10e6eaaa24ad985c95e51f88f75 (diff) | |
download | bitcoin-9f556622c57d3f7a0fdc8e3807fd798ee4b5a2fe.tar.xz |
Merge #14328: [0.17] Backports
542651cfb4 travis: Remove deprecated sudo (MarcoFalke)
ec71f06a8d build: Add bitcoin-tx.exe into Windows installer (Chun Kuan Lee)
7edebedef1 build: Remove illegal spacing in darwin.mk (Jon Layton)
fb9ad043f8 Fix listreceivedbyaddress not taking address as a string (Eric Scrivner)
91fa15aaeb wallet: Avoid potential use of unitialized value bnb_used in CWallet::CreateTransaction(...) (practicalswift)
96f15e8bb3 Tests: Fix a comment (fridokus)
60f7a97930 qa: Add test to ensure node can generate all help texts at runtime (MarcoFalke)
2f9fd29321 disallow oversized CBlockHeaderAndShortTxIDs (Kaz Wesley)
5331ad0506 fix a deserialization overflow edge case (Kaz Wesley)
94065024c7 add a test demonstrating an overflow in a deserialization edge case (Kaz Wesley)
85aacc41ba Add autogen.sh in ARM Cross-compilation (Walter)
bb90695551 [wallet] Ensure wallet is unlocked before signing (gustavonalle)
Pull request description:
Tree-SHA512: d82813134e5fc5437fe690127a4701d7ba66bf27799d7ecb1fbc2cc4dd81b6b3f708c1f314b725e8a3a6525ffa388299e277157f784f762256e01afb24822b25
Diffstat (limited to 'src/blockencodings.h')
-rw-r--r-- | src/blockencodings.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/blockencodings.h b/src/blockencodings.h index fad1f56f54..0c2b83ebcf 100644 --- a/src/blockencodings.h +++ b/src/blockencodings.h @@ -52,12 +52,12 @@ public: } } - uint16_t offset = 0; + int32_t offset = 0; for (size_t j = 0; j < indexes.size(); j++) { - if (uint64_t(indexes[j]) + uint64_t(offset) > std::numeric_limits<uint16_t>::max()) + if (int32_t(indexes[j]) + offset > std::numeric_limits<uint16_t>::max()) throw std::ios_base::failure("indexes overflowed 16 bits"); indexes[j] = indexes[j] + offset; - offset = indexes[j] + 1; + offset = int32_t(indexes[j]) + 1; } } else { for (size_t i = 0; i < indexes.size(); i++) { @@ -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(); } |