Added basic fuzzing to the monolith, see ticket #4155
This commit is contained in:
parent
ffb8e6747b
commit
7e8b18e480
|
@ -186,7 +186,10 @@ bool AppInit(int argc, char* argv[])
|
|||
|
||||
return fRet;
|
||||
}
|
||||
|
||||
#include "fuzz.h"
|
||||
#ifdef ZCASH_FUZZ
|
||||
#include "fuzz.cpp"
|
||||
#else
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
SetupEnvironment();
|
||||
|
@ -196,3 +199,4 @@ int main(int argc, char* argv[])
|
|||
|
||||
return (AppInit(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
extern bool DecodeHexTx(CTransaction& tx, const std::string& strHexTx);
|
||||
|
||||
bool fuzz_DecodeHexTxFunction (const std::string& strHexTx) {
|
||||
CTransaction tx;
|
||||
return DecodeHexTx(tx, strHexTx);
|
||||
}
|
||||
|
||||
|
||||
int fuzz_DecodeHexTx (int argc, char *argv[]) {
|
||||
std::ifstream t(argv[1]);
|
||||
std::string str((std::istreambuf_iterator<char>(t)),
|
||||
std::istreambuf_iterator<char>());
|
||||
if (fuzz_DecodeHexTxFunction (str)) { fprintf(stdout, "Decoded hex string") ; return 0; }
|
||||
else { fprintf(stderr, "Could not decode hex string") ; return -1; }
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[]) { return ZCASH_FUZZER_MAIN(argc, argv); }
|
||||
#warning BUILDING A FUZZER, NOT THE REAL MAIN
|
|
@ -0,0 +1,2 @@
|
|||
//#define ZCASH_FUZZ
|
||||
#define ZCASH_FUZZER_MAIN fuzz_DecodeHexTx
|
Loading…
Reference in New Issue