srctree

Robin Linden parent f7623074 f12b1ef9
img/test: Set up fuzz tests for all image types

inlinesplit
filename was Deleted added: 60, removed: 3, total 57
@@ -0,0 +1,19 @@
// SPDX-FileCopyrightText: 2024 Robin Lindén <dev@robinlinden.eu>
//
// SPDX-License-Identifier: BSD-2-Clause
 
#include "img/gif.h"
 
#include <sstream>
#include <stddef.h> // NOLINT
#include <stdint.h> // NOLINT
#include <string>
#include <tuple>
 
extern "C" int LLVMFuzzerTestOneInput(uint8_t const *data, size_t size); // NOLINT
 
extern "C" int LLVMFuzzerTestOneInput(uint8_t const *data, size_t size) {
std::ignore = img::Gif::from( //
std::stringstream{std::string{reinterpret_cast<char const *>(data), size}});
return 0;
}
 
filename was Deleted added: 60, removed: 3, total 57
@@ -0,0 +1,19 @@
// SPDX-FileCopyrightText: 2024 Robin Lindén <dev@robinlinden.eu>
//
// SPDX-License-Identifier: BSD-2-Clause
 
#include "img/jpeg.h"
 
#include <sstream>
#include <stddef.h> // NOLINT
#include <stdint.h> // NOLINT
#include <string>
#include <tuple>
 
extern "C" int LLVMFuzzerTestOneInput(uint8_t const *data, size_t size); // NOLINT
 
extern "C" int LLVMFuzzerTestOneInput(uint8_t const *data, size_t size) {
std::ignore = img::Jpeg::thumbnail_from( //
std::stringstream{std::string{reinterpret_cast<char const *>(data), size}});
return 0;
}
 
filename was Deleted added: 60, removed: 3, total 57
@@ -0,0 +1,19 @@
// SPDX-FileCopyrightText: 2024 Robin Lindén <dev@robinlinden.eu>
//
// SPDX-License-Identifier: BSD-2-Clause
 
#include "img/png.h"
 
#include <sstream>
#include <stddef.h> // NOLINT
#include <stdint.h> // NOLINT
#include <string>
#include <tuple>
 
extern "C" int LLVMFuzzerTestOneInput(uint8_t const *data, size_t size); // NOLINT
 
extern "C" int LLVMFuzzerTestOneInput(uint8_t const *data, size_t size) {
std::ignore = img::Png::from( //
std::stringstream{std::string{reinterpret_cast<char const *>(data), size}});
return 0;
}