forked from brunoerg/bitcoinfuzz
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfuzzer.cpp
31 lines (26 loc) · 931 Bytes
/
fuzzer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <assert.h>
#include <ctype.h>
#include <iostream>
#include <stdio.h>
#include <string>
#include <fuzzer/FuzzedDataProvider.h>
#include "targets/miniscript_policy.h"
#include "targets/miniscript_string.h"
#include "targets/block_des.h"
#include "targets/prefilledtransaction.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
FuzzedDataProvider provider(data, size);
std::string target{std::getenv("FUZZ")};
if (target == "miniscript_policy") {
MiniscriptPolicy(provider);
} else if (target == "miniscript_string") {
MiniscriptFromString(provider);
} else if (target == "block_deserialization") {
BlockDes(provider);
} else if (target == "prefilledtransaction") {
PrefilledTransactionTarget(provider);
} else {
std::exit(EXIT_SUCCESS);
}
return 0; // Values other than 0 and -1 are reserved for future use.
}