From ef93418b9a3ebe7b610c7cc7730b319b268a171a Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 7 Feb 2022 14:06:31 +0100 Subject: [PATCH] Merge bitcoin/bitcoin#24227: Fix unsigned integer overflow in LoadMempool fadcd031390dd4588bbb1c07e5020a7131312050 Fix unsigned integer overflow in LoadMempool (MarcoFalke) Pull request description: It doesn't seem ideal to have an integer sanitizer enabled, but then disable it for the whole validation.cpp file. This removes one of the two violations. This should be a refactor. ACKs for top commit: prayank23: Code Review ACK https://github.com/bitcoin/bitcoin/pull/24227/commits/fadcd031390dd4588bbb1c07e5020a7131312050 Tree-SHA512: 9fb2f3d49008a59cd45b7c17be0c88c04e61183197c11c8176865af5532c8d0c940db49a351dd0fc75e1d7fd8678c3b816d34cfca170dc6b9cf8f37fdf1c8cae --- src/validation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/validation.cpp b/src/validation.cpp index 32a628e665..9ea0db0ce1 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -5308,7 +5308,8 @@ bool LoadMempool(CTxMemPool& pool) } uint64_t num; file >> num; - while (num--) { + while (num) { + --num; CTransactionRef tx; int64_t nTime; int64_t nFeeDelta;