refactor: Use uint64_t over size_t for serialize corruption check in fees.dat
What changed, and why it matters
This is a one-line type change in Bitcoin Core's fee estimation data reader. It changes two local variables from 'size_t' (whose size varies by platform) to 'uint64_t' (a fixed 64-bit type) when reading the fees.dat file. The stated purpose is to make a serialization corruption check more consistent across platforms. There is no direct evidence in the commit of an exploitable vulnerability, and the change appears defensive/refactoring in nature.
Treat as a low-risk hardening/refactor commit. No urgent action required. If maintaining 32-bit builds, ensure this code path is covered by existing fee-estimation deserialization tests. Monitor for any related follow-up commits or disclosures.
Security signals we found
Type-width change from architecture-dependent size_t to fixed-width uint64_t
Located in deserialization/sanity-checking code for persisted fee estimates
Potential integer truncation concern on 32-bit platforms if size_t were used
No explicit security claim or CVE in commit message
Evidence from the diff
In TxConfirmStats::Read(), the local variables maxConfirms and maxPeriods are changed from size_t to uint64_t. These variables are populated by deserialization and then compared against numBuckets (a size_t parameter) in a sanity check. On 32-bit platforms, size_t is 32 bits, while the serialized data may contain 64-bit values. Using uint64_t ensures the comparison values are not truncated before the bounds check, which could theoretically allow an oversized value to pass a sanity check on 32-bit builds. The commit message frames this as a refactor for the corruption check, not as a security fix.
Changed components
src/policy/fees/block_policy_estimator.cppTxConfirmStats::Read()Bitcoin Core fee estimation persistence (fees.dat)Inspect captured patch +1 / −1
diff --git a/src/policy/fees/block_policy_estimator.cpp b/src/policy/fees/block_policy_estimator.cpp
index 80b4f641..c05ece34 100644
--- a/src/policy/fees/block_policy_estimator.cpp
+++ b/src/policy/fees/block_policy_estimator.cpp
@@ -423,7 +423,7 @@ void TxConfirmStats::Read(AutoFile& filein, size_t numBuckets)
// Read data file and do some very basic sanity checking
// buckets and bucketMap are not updated yet, so don't access them
// If there is a read failure, we'll just discard this entire object anyway
- size_t maxConfirms, maxPeriods;
+ uint64_t maxConfirms, maxPeriods;
// The current version will store the decay with each individual TxConfirmStats and also keep a scale factor
filein >> Using<EncodedDoubleFormatter>(decay);
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.