Browse Source

[tests] Add fuzz testing for BlockTransactions and BlockTransactionsRequest

0.16
practicalswift 7 years ago
parent
commit
fd3a2f3130
  1. 23
      src/test/test_bitcoin_fuzzy.cpp

23
src/test/test_bitcoin_fuzzy.cpp

@ -19,6 +19,7 @@
#include "undo.h" #include "undo.h"
#include "version.h" #include "version.h"
#include "pubkey.h" #include "pubkey.h"
#include "blockencodings.h"
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <unistd.h>
@ -45,6 +46,8 @@ enum TEST_ID {
CBLOOMFILTER_DESERIALIZE, CBLOOMFILTER_DESERIALIZE,
CDISKBLOCKINDEX_DESERIALIZE, CDISKBLOCKINDEX_DESERIALIZE,
CTXOUTCOMPRESSOR_DESERIALIZE, CTXOUTCOMPRESSOR_DESERIALIZE,
BLOCKTRANSACTIONS_DESERIALIZE,
BLOCKTRANSACTIONSREQUEST_DESERIALIZE,
TEST_ID_END TEST_ID_END
}; };
@ -245,6 +248,26 @@ int test_one_input(std::vector<uint8_t> buffer) {
break; break;
} }
case BLOCKTRANSACTIONS_DESERIALIZE:
{
try
{
BlockTransactions bt;
ds >> bt;
} catch (const std::ios_base::failure& e) {return 0;}
break;
}
case BLOCKTRANSACTIONSREQUEST_DESERIALIZE:
{
try
{
BlockTransactionsRequest btr;
ds >> btr;
} catch (const std::ios_base::failure& e) {return 0;}
break;
}
default: default:
return 0; return 0;
} }

Loading…
Cancel
Save