From 7062d9484b3a01108b672595107a4e763ff7f686 Mon Sep 17 00:00:00 2001 From: Raj Shah Date: Thu, 17 Nov 2022 06:11:19 +0000 Subject: [PATCH] Add harness --- mayhem/fuzz.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 mayhem/fuzz.cpp diff --git a/mayhem/fuzz.cpp b/mayhem/fuzz.cpp new file mode 100644 index 0000000..c6ade71 --- /dev/null +++ b/mayhem/fuzz.cpp @@ -0,0 +1,21 @@ +#include +#include +#include + +#include + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + FuzzedDataProvider provider(data, size); + int src_width = provider.ConsumeIntegralInRange(0, INT_MAX); + int src_height = provider.ConsumeIntegralInRange(0, INT_MAX); + int dest_width_inout = provider.ConsumeIntegral(); + int dest_height_inout = provider.ConsumeIntegral(); + int font_ratio = provider.ConsumeFloatingPointInRange(1, 100); + int zoom = provider.ConsumeIntegral(); + int stretch = provider.ConsumeIntegral(); + + // chafa_calc_canvas_geometry(src_width, src_height, &dest_width_inout, &dest_height_inout, font_ratio, zoom, stretch); + + return 0; +} \ No newline at end of file