mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-24 14:11:02 +00:00
Prepare fuzzing engine
This commit is contained in:
31
src/fuzzing-engine/fuzzer.hpp
Normal file
31
src/fuzzing-engine/fuzzer.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include <span>
|
||||
#include <thread>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
|
||||
namespace fuzzer
|
||||
{
|
||||
using coverage_functor = void(uint64_t address);
|
||||
|
||||
enum class execution_result
|
||||
{
|
||||
success,
|
||||
error,
|
||||
};
|
||||
|
||||
struct fuzzing_handler
|
||||
{
|
||||
virtual ~fuzzing_handler() = default;
|
||||
|
||||
virtual execution_result execute(std::span<const uint8_t> data,
|
||||
const std::function<coverage_functor>& coverage_handler) = 0;
|
||||
|
||||
virtual bool stop()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
void run(fuzzing_handler& handler, size_t concurrency = std::thread::hardware_concurrency());
|
||||
}
|
||||
Reference in New Issue
Block a user