diff options
author | MarcoFalke <falke.marco@gmail.com> | 2022-02-09 08:30:34 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2022-02-09 08:30:38 +0100 |
commit | 8ac79973f8e923e9f1f560f4909b912ccea34035 (patch) | |
tree | 37ceb2e512b3073da951222d1f86496b95fc5e67 | |
parent | b7942c94824e4e06489417ee587d1f3ac631fce0 (diff) | |
parent | fac62056b56e0a28baf0b6f285752d83fbf96074 (diff) |
Merge bitcoin/bitcoin#24196: Fix integer sanitizer suppressions in validation.cpp
fac62056b56e0a28baf0b6f285752d83fbf96074 Fix integer sanitizer suppressions in validation.cpp (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.
Fix it with a refactor and remove the suppression.
ACKs for top commit:
hebasto:
ACK fac62056b56e0a28baf0b6f285752d83fbf96074, I have reviewed the code and it looks OK, I agree it can be merged.
prayank23:
Code Review ACK https://github.com/bitcoin/bitcoin/pull/24196/commits/fac62056b56e0a28baf0b6f285752d83fbf96074
Tree-SHA512: efc5b9887cb2e207033b264ebf425bae5ff013e909701c049aea5d79a21f10495826e962d171b3d412717cbf0a4723e5124133b5401b35a73915212e85e91020
-rw-r--r-- | src/validation.cpp | 5 | ||||
-rw-r--r-- | test/sanitizer_suppressions/ubsan | 1 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index f2fa1cf8d5..e20e2fe523 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1787,8 +1787,9 @@ DisconnectResult CChainState::DisconnectBlock(const CBlock& block, const CBlockI error("DisconnectBlock(): transaction and undo data inconsistent"); return DISCONNECT_FAILED; } - for (unsigned int j = tx.vin.size(); j-- > 0;) { - const COutPoint &out = tx.vin[j].prevout; + for (unsigned int j = tx.vin.size(); j > 0;) { + --j; + const COutPoint& out = tx.vin[j].prevout; int res = ApplyTxInUndo(std::move(txundo.vprevout[j]), view, out); if (res == DISCONNECT_FAILED) return DISCONNECT_FAILED; fClean = fClean && res != DISCONNECT_UNCLEAN; diff --git a/test/sanitizer_suppressions/ubsan b/test/sanitizer_suppressions/ubsan index 46f36f282f..025bfc1ac0 100644 --- a/test/sanitizer_suppressions/ubsan +++ b/test/sanitizer_suppressions/ubsan @@ -57,7 +57,6 @@ unsigned-integer-overflow:pubkey.h unsigned-integer-overflow:script/interpreter.cpp unsigned-integer-overflow:txmempool.cpp unsigned-integer-overflow:util/strencodings.cpp -unsigned-integer-overflow:validation.cpp implicit-integer-sign-change:addrman.h implicit-integer-sign-change:bech32.cpp implicit-integer-sign-change:compat/stdin.cpp |