system: Linux mars.sprixweb.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
// Copyright 2023 Google LLC
// SPDX-License-Identifier: BSD-2-Clause
#include <cstddef>
#include <cstdint>
#include <fstream>
#include <iostream>
#include <vector>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size);
namespace
{
std::vector<uint8_t> ReadFile(const char * path)
{
std::vector<uint8_t> buffer;
std::ifstream file(path, std::ios::binary);
buffer.resize(file.seekg(0, std::ios::end).tellg());
file.seekg(0, std::ios::beg).read(reinterpret_cast<char *>(buffer.data()), buffer.size());
return buffer;
}
} // namespace
int main(int argc, char * argv[])
{
if (argc < 2) {
std::cerr << "Missing reproducer file" << std::endl;
return 1;
}
for (int i = 1; i < argc; ++i) {
const std::vector<uint8_t> buffer = ReadFile(argv[i]);
LLVMFuzzerTestOneInput(buffer.data(), buffer.size());
}
return 0;
}