[tests] Add fuzz testing for BlockTransactions and BlockTransactionsRequest

pull/476/merge
practicalswift 7 years ago
parent 57ee73990f
commit fd3a2f3130

@ -19,6 +19,7 @@
#include "undo.h"
#include "version.h"
#include "pubkey.h"
#include "blockencodings.h"
#include <stdint.h>
#include <unistd.h>
@ -45,6 +46,8 @@ enum TEST_ID {
CBLOOMFILTER_DESERIALIZE,
CDISKBLOCKINDEX_DESERIALIZE,
CTXOUTCOMPRESSOR_DESERIALIZE,
BLOCKTRANSACTIONS_DESERIALIZE,
BLOCKTRANSACTIONSREQUEST_DESERIALIZE,
TEST_ID_END
};
@ -245,6 +248,26 @@ int test_one_input(std::vector<uint8_t> buffer) {
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:
return 0;
}

Loading…
Cancel
Save