From 044203039cebe3c05161f8f104a039d4744ca6d0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 06:20:26 +0200 Subject: Adding upstream version 2.1.30. Signed-off-by: Daniel Baumann --- tests/fuzz/main.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/fuzz/main.c (limited to 'tests/fuzz/main.c') diff --git a/tests/fuzz/main.c b/tests/fuzz/main.c new file mode 100644 index 0000000..a4b64b5 --- /dev/null +++ b/tests/fuzz/main.c @@ -0,0 +1,47 @@ +#include +#include +#include + +int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len); + +#ifdef __AFL_COMPILER + +int main(void) { + int ret; + uint8_t buf[64 * 1024]; + +#ifdef __AFL_LOOP + while (__AFL_LOOP(10000)) +#endif + { + ret = fread(buf, 1, sizeof(buf), stdin); + if (ret < 0) { + return 0; + } + + LLVMFuzzerTestOneInput(buf, ret); + + } + + return 0; +} + +#else + +int +main(void) +{ + int ret; + uint8_t buf[64 * 1024]; + + ret = fread(buf, 1, sizeof(buf), stdin); + if (ret < 0) { + return 0; + } + + LLVMFuzzerTestOneInput(buf, ret); + + return 0; +} + +#endif /* __AFL_COMPILER */ -- cgit v1.2.3