Bitcoin Core  22.99.0
P2P Digital Currency
Macros | Typedefs | Functions
fuzz.h File Reference
#include <span.h>
#include <cstdint>
#include <functional>
#include <string_view>
Include dependency graph for fuzz.h:

Go to the source code of this file.


#define LIMITED_WHILE(condition, limit)   for (unsigned _count{limit}; (condition) && _count; --_count)
 Can be used to limit a theoretically unbounded loop. More...
#define FUZZ_TARGET(name)   FUZZ_TARGET_INIT(name, FuzzFrameworkEmptyInitFun)
#define FUZZ_TARGET_INIT(name, init_fun)   FUZZ_TARGET_INIT_HIDDEN(name, init_fun, false)
#define FUZZ_TARGET_INIT_HIDDEN(name, init_fun, hidden)


using FuzzBufferType = Span< const uint8_t >
using TypeTestOneInput = std::function< void(FuzzBufferType)>
using TypeInitialize = std::function< void()>
using TypeHidden = bool


void FuzzFrameworkRegisterTarget (std::string_view name, TypeTestOneInput target, TypeInitialize init, TypeHidden hidden)
void FuzzFrameworkEmptyInitFun ()

Macro Definition Documentation


#define FUZZ_TARGET (   name)    FUZZ_TARGET_INIT(name, FuzzFrameworkEmptyInitFun)

Definition at line 31 of file fuzz.h.


#define FUZZ_TARGET_INIT (   name,
)    FUZZ_TARGET_INIT_HIDDEN(name, init_fun, false)

Definition at line 34 of file fuzz.h.


#define FUZZ_TARGET_INIT_HIDDEN (   name,
void name##_fuzz_target(FuzzBufferType); \
struct name##_Before_Main { \
name##_Before_Main() \
{ \
FuzzFrameworkRegisterTarget(#name, name##_fuzz_target, init_fun, hidden); \
} \
} const static g_##name##_before_main; \
void name##_fuzz_target(FuzzBufferType buffer)

Definition at line 37 of file fuzz.h.


#define LIMITED_WHILE (   condition,
)    for (unsigned _count{limit}; (condition) && _count; --_count)

Can be used to limit a theoretically unbounded loop.

This caps the runtime to avoid timeouts or OOMs.

Definition at line 18 of file fuzz.h.

Typedef Documentation

◆ FuzzBufferType

using FuzzBufferType = Span<const uint8_t>

Definition at line 21 of file fuzz.h.

◆ TypeHidden

using TypeHidden = bool

Definition at line 25 of file fuzz.h.

◆ TypeInitialize

using TypeInitialize = std::function<void()>

Definition at line 24 of file fuzz.h.

◆ TypeTestOneInput

using TypeTestOneInput = std::function<void(FuzzBufferType)>

Definition at line 23 of file fuzz.h.

Function Documentation

◆ FuzzFrameworkEmptyInitFun()

void FuzzFrameworkEmptyInitFun ( )

Definition at line 29 of file fuzz.h.

◆ FuzzFrameworkRegisterTarget()

void FuzzFrameworkRegisterTarget ( std::string_view  name,
TypeTestOneInput  target,
TypeInitialize  init,
TypeHidden  hidden 

Definition at line 28 of file fuzz.cpp.

Here is the call graph for this function:
A Span is an object that can refer to a contiguous sequence of objects.
Definition: span.h:92
const char * name
Definition: rest.cpp:43