Auto merge of #4179 - defuse:fuzz-addrman, r=str4d

Add More Fuzzing Targets
This commit is contained in:
Homu 2019-11-11 03:14:26 -08:00
commit 019507a8ef
8 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,29 @@
#include "consensus/validation.h"
#include "chainparams.h"
int main (int argc, char *argv[]) {
int retval = 0;
SelectParams(CBaseChainParams::MAIN);
CBlock block;
CAutoFile filein(fopen(argv[1], "rb"), SER_DISK, CLIENT_VERSION);
try {
filein >> block;
} catch (const std::exception& e) {
return -1;
}
// We don't load the SNARK parameters because it's too slow. This means that
// valid blocks with shielded transactions will generate a crash.
const CChainParams& chainparams = Params();
auto verifier = libzcash::ProofVerifier::Disabled();
CValidationState state;
// We don't check the PoW or Merkle tree root in order to reach more code.
if (!CheckBlock(block, state, chainparams, verifier, false, false)) {
retval = -1;
}
return retval;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "addrman.h"
#include "streams.h"
int main (int argc, char *argv[]) {
CAddrMan addrman;
CAutoFile filein(fopen(argv[1], "rb"), SER_DISK, CLIENT_VERSION);
try {
filein >> addrman;
return 0;
} catch (const std::exception&) {
return -1;
}
}

View File

@ -0,0 +1,13 @@
#include "txmempool.h"
int main (int argc, char *argv[]) {
CFeeRate rate;
CTxMemPool mempool(rate);
CAutoFile est_filein(fopen(argv[1], "rb"), SER_DISK, CLIENT_VERSION);
if (mempool.ReadFeeEstimates(est_filein)) {
return 0;
} else {
return -1;
}
}

Binary file not shown.