aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2022-02-07 09:26:32 +0100
committerMarcoFalke <falke.marco@gmail.com>2022-02-07 09:26:35 +0100
commit5034b7fa3b97c1cbaf93b337d462777f3e25d256 (patch)
tree299496ac1065a38001224901185d09f0522db899
parent1e7564eca8a688f39c75540877ec3bdfdde766b1 (diff)
parentfadc54b79b14ba0bbdcf5eff1277295851fe7a9e (diff)
Merge bitcoin/bitcoin#24217: Fix unsigned integer overflow in tapscript validation weight calculation
fadc54b79b14ba0bbdcf5eff1277295851fe7a9e Fix unsigned integer overflow in tapscript validation weight calculation (MarcoFalke) Pull request description: Change the tapscript validation weight constants from uint64_t to int64_t, since the type of m_validation_weight_left is also int64_t. Otherwise this will cause sanitizer warnings. This should be safe because signed integer overflow isn't expected to happen. ACKs for top commit: PastaPastaPasta: utACK fadc54b79b14ba0bbdcf5eff1277295851fe7a9e theStack: Code-review ACK fadc54b79b14ba0bbdcf5eff1277295851fe7a9e Tree-SHA512: 7a62d3a84733ab7827e3fa50d83f5493f2481b725c587e986eb2c128a769f023756f3ad964401526e386a847aa630a9f6c43a57d25ce5fd4af0b6bb5e0615528
-rw-r--r--src/script/script.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/script/script.h b/src/script/script.h
index 3425bf8102..8b7a7bb7b3 100644
--- a/src/script/script.h
+++ b/src/script/script.h
@@ -51,10 +51,10 @@ static const uint32_t LOCKTIME_MAX = 0xFFFFFFFFU;
static constexpr unsigned int ANNEX_TAG = 0x50;
// Validation weight per passing signature (Tapscript only, see BIP 342).
-static constexpr uint64_t VALIDATION_WEIGHT_PER_SIGOP_PASSED = 50;
+static constexpr int64_t VALIDATION_WEIGHT_PER_SIGOP_PASSED{50};
// How much weight budget is added to the witness size (Tapscript only, see BIP 342).
-static constexpr uint64_t VALIDATION_WEIGHT_OFFSET = 50;
+static constexpr int64_t VALIDATION_WEIGHT_OFFSET{50};
template <typename T>
std::vector<unsigned char> ToByteVector(const T& in)