Bitcoin Core  22.99.0
P2P Digital Currency
Macros | Functions | Variables
deserialize.cpp File Reference
#include <addrdb.h>
#include <addrman.h>
#include <blockencodings.h>
#include <blockfilter.h>
#include <chain.h>
#include <coins.h>
#include <compressor.h>
#include <consensus/merkle.h>
#include <key.h>
#include <merkleblock.h>
#include <net.h>
#include <netbase.h>
#include <node/utxo_snapshot.h>
#include <primitives/block.h>
#include <protocol.h>
#include <psbt.h>
#include <pubkey.h>
#include <script/keyorigin.h>
#include <streams.h>
#include <undo.h>
#include <version.h>
#include <exception>
#include <optional>
#include <stdexcept>
#include <stdint.h>
#include <unistd.h>
#include <test/fuzz/fuzz.h>
Include dependency graph for deserialize.cpp:

Go to the source code of this file.

Macros

#define FUZZ_TARGET_DESERIALIZE(name, code)
 

Functions

void initialize_deserialize ()
 
 FUZZ_TARGET_DESERIALIZE (block_filter_deserialize, { BlockFilter block_filter;DeserializeFromFuzzingInput(buffer, block_filter);}) FUZZ_TARGET_DESERIALIZE(addr_info_deserialize
 
 DeserializeFromFuzzingInput (buffer, addr_info)
 
 FUZZ_TARGET_DESERIALIZE (block_file_info_deserialize, { CBlockFileInfo block_file_info;DeserializeFromFuzzingInput(buffer, block_file_info);}) FUZZ_TARGET_DESERIALIZE(block_header_and_short_txids_deserialize
 
 DeserializeFromFuzzingInput (buffer, block_header_and_short_txids)
 
 FUZZ_TARGET_DESERIALIZE (fee_rate_deserialize, { CFeeRate fee_rate;DeserializeFromFuzzingInput(buffer, fee_rate);AssertEqualAfterSerializeDeserialize(fee_rate);}) FUZZ_TARGET_DESERIALIZE(merkle_block_deserialize
 
 DeserializeFromFuzzingInput (buffer, merkle_block)
 
 FUZZ_TARGET_DESERIALIZE (out_point_deserialize, { COutPoint out_point;DeserializeFromFuzzingInput(buffer, out_point);AssertEqualAfterSerializeDeserialize(out_point);}) FUZZ_TARGET_DESERIALIZE(partial_merkle_tree_deserialize
 
 DeserializeFromFuzzingInput (buffer, partial_merkle_tree)
 
 FUZZ_TARGET_DESERIALIZE (pub_key_deserialize, { CPubKey pub_key;DeserializeFromFuzzingInput(buffer, pub_key);AssertEqualAfterSerializeDeserialize(pub_key);}) FUZZ_TARGET_DESERIALIZE(script_deserialize
 
 DeserializeFromFuzzingInput (buffer, script)
 
 FUZZ_TARGET_DESERIALIZE (tx_in_deserialize, { CTxIn tx_in;DeserializeFromFuzzingInput(buffer, tx_in);AssertEqualAfterSerializeDeserialize(tx_in);}) FUZZ_TARGET_DESERIALIZE(flat_file_pos_deserialize
 
 DeserializeFromFuzzingInput (buffer, flat_file_pos)
 
 AssertEqualAfterSerializeDeserialize (flat_file_pos)
 
 FUZZ_TARGET_DESERIALIZE (key_origin_info_deserialize, { KeyOriginInfo key_origin_info;DeserializeFromFuzzingInput(buffer, key_origin_info);AssertEqualAfterSerializeDeserialize(key_origin_info);}) FUZZ_TARGET_DESERIALIZE(partially_signed_transaction_deserialize
 
 DeserializeFromFuzzingInput (buffer, partially_signed_transaction)
 
 FUZZ_TARGET_DESERIALIZE (prefilled_transaction_deserialize, { PrefilledTransaction prefilled_transaction;DeserializeFromFuzzingInput(buffer, prefilled_transaction);}) FUZZ_TARGET_DESERIALIZE(psbt_input_deserialize
 
 DeserializeFromFuzzingInput (buffer, psbt_input)
 
 FUZZ_TARGET_DESERIALIZE (psbt_output_deserialize, { PSBTOutput psbt_output;DeserializeFromFuzzingInput(buffer, psbt_output);}) FUZZ_TARGET_DESERIALIZE(block_deserialize
 
 DeserializeFromFuzzingInput (buffer, block)
 
 FUZZ_TARGET_DESERIALIZE (blocklocator_deserialize, { CBlockLocator bl;DeserializeFromFuzzingInput(buffer, bl);}) FUZZ_TARGET_DESERIALIZE(blockmerkleroot
 
 BlockMerkleRoot (block, &mutated)
 
 FUZZ_TARGET_DESERIALIZE (addrman_deserialize, { CAddrMan am(std::vector< bool >(), false, 0);DeserializeFromFuzzingInput(buffer, am);}) FUZZ_TARGET_DESERIALIZE(blockheader_deserialize
 
 DeserializeFromFuzzingInput (buffer, bh)
 
 FUZZ_TARGET_DESERIALIZE (txundo_deserialize, { CTxUndo tu;DeserializeFromFuzzingInput(buffer, tu);}) FUZZ_TARGET_DESERIALIZE(blockundo_deserialize
 
 DeserializeFromFuzzingInput (buffer, bu)
 
 FUZZ_TARGET_DESERIALIZE (coins_deserialize, { Coin coin;DeserializeFromFuzzingInput(buffer, coin);}) FUZZ_TARGET_DESERIALIZE(netaddr_deserialize
 
 DeserializeFromFuzzingInput (buffer, na)
 
 if (na.IsAddrV1Compatible())
 
 AssertEqualAfterSerializeDeserialize (na, INIT_PROTO_VERSION|ADDRV2_FORMAT)
 
 FUZZ_TARGET_DESERIALIZE (service_deserialize, { CService s;DeserializeFromFuzzingInput(buffer, s);if(s.IsAddrV1Compatible()) { AssertEqualAfterSerializeDeserialize(s);} AssertEqualAfterSerializeDeserialize(s, INIT_PROTO_VERSION|ADDRV2_FORMAT);CService s1;DeserializeFromFuzzingInput(buffer, s1, INIT_PROTO_VERSION);AssertEqualAfterSerializeDeserialize(s1, INIT_PROTO_VERSION);assert(s1.IsAddrV1Compatible());CService s2;DeserializeFromFuzzingInput(buffer, s2, INIT_PROTO_VERSION|ADDRV2_FORMAT);AssertEqualAfterSerializeDeserialize(s2, INIT_PROTO_VERSION|ADDRV2_FORMAT);}) FUZZ_TARGET_DESERIALIZE(messageheader_deserialize
 
 DeserializeFromFuzzingInput (buffer, mh)
 
void mh IsCommandValid ()
 
 FUZZ_TARGET_DESERIALIZE (address_deserialize_v1_notime, { CAddress a;DeserializeFromFuzzingInput(buffer, a, INIT_PROTO_VERSION);AssertEqualAfterSerializeDeserialize(a, INIT_PROTO_VERSION);AssertEqualAfterSerializeDeserialize(a, PROTOCOL_VERSION);AssertEqualAfterSerializeDeserialize(a, 0, SER_DISK);AssertEqualAfterSerializeDeserialize(a, PROTOCOL_VERSION|ADDRV2_FORMAT);AssertEqualAfterSerializeDeserialize(a, ADDRV2_FORMAT, SER_DISK);}) FUZZ_TARGET_DESERIALIZE(address_deserialize_v1_withtime
 
 DeserializeFromFuzzingInput (buffer, a, PROTOCOL_VERSION)
 
 AssertEqualAfterSerializeDeserialize (a, PROTOCOL_VERSION)
 
 AssertEqualAfterSerializeDeserialize (a, 0, SER_DISK)
 
 AssertEqualAfterSerializeDeserialize (a, PROTOCOL_VERSION|ADDRV2_FORMAT)
 
 AssertEqualAfterSerializeDeserialize (a, ADDRV2_FORMAT, SER_DISK)
 
 FUZZ_TARGET_DESERIALIZE (address_deserialize_v2, { CAddress a;DeserializeFromFuzzingInput(buffer, a, PROTOCOL_VERSION|ADDRV2_FORMAT);if(a.IsAddrV1Compatible()) { AssertEqualAfterSerializeDeserialize(a, PROTOCOL_VERSION);AssertEqualAfterSerializeDeserialize(a, 0, SER_DISK);} AssertEqualAfterSerializeDeserialize(a, PROTOCOL_VERSION|ADDRV2_FORMAT);AssertEqualAfterSerializeDeserialize(a, ADDRV2_FORMAT, SER_DISK);}) FUZZ_TARGET_DESERIALIZE(inv_deserialize
 
 DeserializeFromFuzzingInput (buffer, i)
 
 FUZZ_TARGET_DESERIALIZE (bloomfilter_deserialize, { CBloomFilter bf;DeserializeFromFuzzingInput(buffer, bf);}) FUZZ_TARGET_DESERIALIZE(diskblockindex_deserialize
 
 DeserializeFromFuzzingInput (buffer, dbi)
 
 FUZZ_TARGET_DESERIALIZE (txoutcompressor_deserialize, { CTxOut to;auto toc=Using< TxOutCompression >(to);DeserializeFromFuzzingInput(buffer, toc);}) FUZZ_TARGET_DESERIALIZE(blocktransactions_deserialize
 
 DeserializeFromFuzzingInput (buffer, bt)
 
 FUZZ_TARGET_DESERIALIZE (blocktransactionsrequest_deserialize, { BlockTransactionsRequest btr;DeserializeFromFuzzingInput(buffer, btr);}) FUZZ_TARGET_DESERIALIZE(snapshotmetadata_deserialize
 
 DeserializeFromFuzzingInput (buffer, snapshot_metadata)
 
 FUZZ_TARGET_DESERIALIZE (uint160_deserialize, { uint160 u160;DeserializeFromFuzzingInput(buffer, u160);AssertEqualAfterSerializeDeserialize(u160);}) FUZZ_TARGET_DESERIALIZE(uint256_deserialize
 
 DeserializeFromFuzzingInput (buffer, u256)
 
 AssertEqualAfterSerializeDeserialize (u256)
 

Variables

bool mutated
 

Macro Definition Documentation

◆ FUZZ_TARGET_DESERIALIZE

#define FUZZ_TARGET_DESERIALIZE (   name,
  code 
)
Value:
{ \
try { \
code \
} catch (const invalid_fuzzing_input_exception&) { \
} \
}

Definition at line 41 of file deserialize.cpp.

Function Documentation

◆ AssertEqualAfterSerializeDeserialize() [1/7]

AssertEqualAfterSerializeDeserialize ( ,
,
SER_DISK   
)

◆ AssertEqualAfterSerializeDeserialize() [2/7]

AssertEqualAfterSerializeDeserialize ( ,
ADDRV2_FORMAT  ,
SER_DISK   
)

◆ AssertEqualAfterSerializeDeserialize() [3/7]

AssertEqualAfterSerializeDeserialize ( ,
PROTOCOL_VERSION   
)

◆ AssertEqualAfterSerializeDeserialize() [4/7]

AssertEqualAfterSerializeDeserialize ( ,
PROTOCOL_VERSION ADDRV2_FORMAT 
)

◆ AssertEqualAfterSerializeDeserialize() [5/7]

AssertEqualAfterSerializeDeserialize ( flat_file_pos  )
Here is the caller graph for this function:

◆ AssertEqualAfterSerializeDeserialize() [6/7]

AssertEqualAfterSerializeDeserialize ( na  ,
INIT_PROTO_VERSION ADDRV2_FORMAT 
)

◆ AssertEqualAfterSerializeDeserialize() [7/7]

AssertEqualAfterSerializeDeserialize ( u256  )

◆ BlockMerkleRoot()

BlockMerkleRoot ( block  ,
mutated 
)

◆ DeserializeFromFuzzingInput() [1/19]

DeserializeFromFuzzingInput ( buffer  ,
,
PROTOCOL_VERSION   
)

◆ DeserializeFromFuzzingInput() [2/19]

DeserializeFromFuzzingInput ( buffer  ,
addr_info   
)

◆ DeserializeFromFuzzingInput() [3/19]

DeserializeFromFuzzingInput ( buffer  ,
bh   
)

◆ DeserializeFromFuzzingInput() [4/19]

DeserializeFromFuzzingInput ( buffer  ,
block   
)
Initial value:
{
CBlock block

◆ DeserializeFromFuzzingInput() [5/19]

DeserializeFromFuzzingInput ( buffer  ,
block_header_and_short_txids   
)

◆ DeserializeFromFuzzingInput() [6/19]

DeserializeFromFuzzingInput ( buffer  ,
bt   
)

◆ DeserializeFromFuzzingInput() [7/19]

DeserializeFromFuzzingInput ( buffer  ,
bu   
)

◆ DeserializeFromFuzzingInput() [8/19]

DeserializeFromFuzzingInput ( buffer  ,
dbi   
)

◆ DeserializeFromFuzzingInput() [9/19]

DeserializeFromFuzzingInput ( buffer  ,
flat_file_pos   
)

◆ DeserializeFromFuzzingInput() [10/19]

DeserializeFromFuzzingInput ( buffer  ,
 
)

◆ DeserializeFromFuzzingInput() [11/19]

DeserializeFromFuzzingInput ( buffer  ,
merkle_block   
)

◆ DeserializeFromFuzzingInput() [12/19]

DeserializeFromFuzzingInput ( buffer  ,
mh   
)

◆ DeserializeFromFuzzingInput() [13/19]

DeserializeFromFuzzingInput ( buffer  ,
na   
)

◆ DeserializeFromFuzzingInput() [14/19]

DeserializeFromFuzzingInput ( buffer  ,
partial_merkle_tree   
)

◆ DeserializeFromFuzzingInput() [15/19]

DeserializeFromFuzzingInput ( buffer  ,
partially_signed_transaction   
)

◆ DeserializeFromFuzzingInput() [16/19]

DeserializeFromFuzzingInput ( buffer  ,
psbt_input   
)

◆ DeserializeFromFuzzingInput() [17/19]

DeserializeFromFuzzingInput ( buffer  ,
script   
)

◆ DeserializeFromFuzzingInput() [18/19]

DeserializeFromFuzzingInput ( buffer  ,
snapshot_metadata   
)

◆ DeserializeFromFuzzingInput() [19/19]

DeserializeFromFuzzingInput ( buffer  ,
u256   
)

◆ FUZZ_TARGET_DESERIALIZE() [1/20]

◆ FUZZ_TARGET_DESERIALIZE() [2/20]

◆ FUZZ_TARGET_DESERIALIZE() [3/20]

FUZZ_TARGET_DESERIALIZE ( addrman_deserialize  ,
{ CAddrMan am(std::vector< bool >(), false, 0);DeserializeFromFuzzingInput(buffer, am);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [4/20]

FUZZ_TARGET_DESERIALIZE ( block_file_info_deserialize  ,
{ CBlockFileInfo block_file_info;DeserializeFromFuzzingInput(buffer, block_file_info);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [5/20]

FUZZ_TARGET_DESERIALIZE ( block_filter_deserialize  ,
{ BlockFilter block_filter;DeserializeFromFuzzingInput(buffer, block_filter);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [6/20]

FUZZ_TARGET_DESERIALIZE ( blocklocator_deserialize  ,
{ CBlockLocator bl;DeserializeFromFuzzingInput(buffer, bl);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [7/20]

FUZZ_TARGET_DESERIALIZE ( blocktransactionsrequest_deserialize  ,
{ BlockTransactionsRequest btr;DeserializeFromFuzzingInput(buffer, btr);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [8/20]

FUZZ_TARGET_DESERIALIZE ( bloomfilter_deserialize  ,
{ CBloomFilter bf;DeserializeFromFuzzingInput(buffer, bf);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [9/20]

FUZZ_TARGET_DESERIALIZE ( coins_deserialize  ,
{ Coin coin;DeserializeFromFuzzingInput(buffer, coin);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [10/20]

FUZZ_TARGET_DESERIALIZE ( fee_rate_deserialize  ,
{ CFeeRate fee_rate;DeserializeFromFuzzingInput(buffer, fee_rate);AssertEqualAfterSerializeDeserialize(fee_rate);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [11/20]

FUZZ_TARGET_DESERIALIZE ( key_origin_info_deserialize  ,
{ KeyOriginInfo key_origin_info;DeserializeFromFuzzingInput(buffer, key_origin_info);AssertEqualAfterSerializeDeserialize(key_origin_info);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [12/20]

FUZZ_TARGET_DESERIALIZE ( out_point_deserialize  ,
{ COutPoint out_point;DeserializeFromFuzzingInput(buffer, out_point);AssertEqualAfterSerializeDeserialize(out_point);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [13/20]

FUZZ_TARGET_DESERIALIZE ( prefilled_transaction_deserialize  ,
{ PrefilledTransaction prefilled_transaction;DeserializeFromFuzzingInput(buffer, prefilled_transaction);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [14/20]

FUZZ_TARGET_DESERIALIZE ( psbt_output_deserialize  ,
{ PSBTOutput psbt_output;DeserializeFromFuzzingInput(buffer, psbt_output);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [15/20]

FUZZ_TARGET_DESERIALIZE ( pub_key_deserialize  ,
{ CPubKey pub_key;DeserializeFromFuzzingInput(buffer, pub_key);AssertEqualAfterSerializeDeserialize(pub_key);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [16/20]

◆ FUZZ_TARGET_DESERIALIZE() [17/20]

FUZZ_TARGET_DESERIALIZE ( tx_in_deserialize  ,
{ CTxIn tx_in;DeserializeFromFuzzingInput(buffer, tx_in);AssertEqualAfterSerializeDeserialize(tx_in);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [18/20]

FUZZ_TARGET_DESERIALIZE ( txoutcompressor_deserialize  ,
{ CTxOut to;auto toc=Using< TxOutCompression >(to);DeserializeFromFuzzingInput(buffer, toc);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [19/20]

FUZZ_TARGET_DESERIALIZE ( txundo_deserialize  ,
{ CTxUndo tu;DeserializeFromFuzzingInput(buffer, tu);}   
)

◆ FUZZ_TARGET_DESERIALIZE() [20/20]

FUZZ_TARGET_DESERIALIZE ( uint160_deserialize  ,
{ uint160 u160;DeserializeFromFuzzingInput(buffer, u160);AssertEqualAfterSerializeDeserialize(u160);}   
)

◆ if()

if ( na.  IsAddrV1Compatible())

Definition at line 213 of file deserialize.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialize_deserialize()

void initialize_deserialize ( )

Definition at line 35 of file deserialize.cpp.

◆ IsCommandValid()

void mh IsCommandValid ( )

Variable Documentation

◆ mutated

bool mutated

Definition at line 187 of file deserialize.cpp.

name
const char * name
Definition: rest.cpp:43
CBlock
Definition: block.h:62
initialize_deserialize
void initialize_deserialize()
Definition: deserialize.cpp:35
FUZZ_TARGET_INIT
#define FUZZ_TARGET_INIT(name, init_fun)
Definition: fuzz.h:34