From d0b1bae8c5c70c5d06f3dcecc450a75e7f7cb5af Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 23 Jul 2024 11:41:28 +0200 Subject: Adding upstream version 3.1.0+dfsg. 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