aboutsummaryrefslogtreecommitdiff
path: root/tests/fuzz/transaction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fuzz/transaction.cpp')
-rw-r--r--tests/fuzz/transaction.cpp36
1 files changed, 5 insertions, 31 deletions
diff --git a/tests/fuzz/transaction.cpp b/tests/fuzz/transaction.cpp
index 9469f82fe..94f0a849f 100644
--- a/tests/fuzz/transaction.cpp
+++ b/tests/fuzz/transaction.cpp
@@ -33,36 +33,10 @@
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "fuzzer.h"
-class TransactionFuzzer: public Fuzzer
-{
-public:
- virtual int run(const std::string &filename);
+BEGIN_INIT_SIMPLE_FUZZER()
+END_INIT_SIMPLE_FUZZER()
-private:
-};
-
-int TransactionFuzzer::run(const std::string &filename)
-{
- std::string s;
-
- if (!epee::file_io_utils::load_file_to_string(filename, s))
- {
- std::cout << "Error: failed to load file " << filename << std::endl;
- return 1;
- }
+BEGIN_SIMPLE_FUZZER()
cryptonote::transaction tx = AUTO_VAL_INIT(tx);
- if(!parse_and_validate_tx_from_blob(s, tx))
- {
- std::cout << "Error: failed to parse transaction from file " << filename << std::endl;
- return 1;
- }
- return 0;
-}
-
-int main(int argc, const char **argv)
-{
- TRY_ENTRY();
- TransactionFuzzer fuzzer;
- return run_fuzzer(argc, argv, fuzzer);
- CATCH_ENTRY_L0("main", 1);
-}
+ parse_and_validate_tx_from_blob(std::string((const char*)buf, len), tx);
+END_SIMPLE_FUZZER()