mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 18:22:57 +02:00
Merge bitcoin/bitcoin#33724: refactor: Return uint64_t from GetSerializeSize
fa6c0bedd3refactor: Return uint64_t from GetSerializeSize (MarcoFalke)fad0c8680erefactor: Use uint64_t over size_t for serialized-size values (MarcoFalke)fa4f388fc9refactor: Use fixed size ints over (un)signed ints for serialized values (MarcoFalke)fa01f38e53move-only: Move CBlockFileInfo to kernel namespace (MarcoFalke)fa2bbc9e4crefactor: [rpc] Remove cast when reporting serialized size (MarcoFalke)fa364af89btest: Remove outdated comment (MarcoFalke) Pull request description: Consensus code should arrive at the same conclusion, regardless of the architecture it runs on. Using architecture-specific types such as `size_t` can lead to issues, such as the low-severity [CVE-2025-46597](https://bitcoincore.org/en/2025/10/24/disclose-cve-2025-46597/). The CVE was already worked around, but it may be good to still fix the underlying issue. Fixes https://github.com/bitcoin/bitcoin/issues/33709 with a few refactors to use explicit fixed-sized integer types in serialization-size related code and concluding with a refactor to return `uint64_t` from `GetSerializeSize`. The refactors should not change any behavior, because the CVE was already worked around. ACKs for top commit: Crypt-iQ: crACKfa6c0bedd3l0rinc: ACKfa6c0bedd3laanwj: Code review ACKfa6c0bedd3Tree-SHA512: f45057bd86fb46011e4cb3edf0dc607057d72ed869fd6ad636562111ae80fea233b2fc45c34b02256331028359a9c3f4fa73e9b882b225bdc089d00becd0195e
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#include <txdb.h>
|
||||
#include <validation.h>
|
||||
|
||||
using kernel::CBlockFileInfo;
|
||||
|
||||
namespace {
|
||||
|
||||
const BasicTestingSetup* g_setup;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <net.h>
|
||||
#include <netbase.h>
|
||||
#include <netgroup.h>
|
||||
#include <node/blockstorage.h>
|
||||
#include <node/utxo_snapshot.h>
|
||||
#include <primitives/block.h>
|
||||
#include <protocol.h>
|
||||
@@ -34,6 +35,7 @@
|
||||
#include <optional>
|
||||
#include <stdexcept>
|
||||
|
||||
using kernel::CBlockFileInfo;
|
||||
using node::SnapshotMetadata;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -1120,7 +1120,7 @@ void TestNode(const MsCtx script_ctx, const NodeRef& node, FuzzedDataProvider& p
|
||||
assert(mal_success);
|
||||
assert(stack_nonmal == stack_mal);
|
||||
// Compute witness size (excluding script push, control block, and witness count encoding).
|
||||
const size_t wit_size = GetSerializeSize(stack_nonmal) - GetSizeOfCompactSize(stack_nonmal.size());
|
||||
const uint64_t wit_size{GetSerializeSize(stack_nonmal) - GetSizeOfCompactSize(stack_nonmal.size())};
|
||||
assert(wit_size <= *node->GetWitnessSize());
|
||||
|
||||
// Test non-malleable satisfaction.
|
||||
|
||||
Reference in New Issue
Block a user