diff --git a/fuzzers/README.md b/fuzzers/README.md deleted file mode 100644 index 4c7ca5ecbf..0000000000 --- a/fuzzers/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# OSS-Fuzz integration - -The fuzzers in this folder are used for our [OSS-Fuzz](https://github.com/google/oss-fuzz) -integration. - -To run this, you can follow the steps: - -```sh -git clone https://github.com/google/oss-fuzz -cd oss-fuzz -python3 infra/helper.py build_fuzzers pacemaker -python3 infra/helper.py run_fuzzer pacemaker utils_fuzzer -``` - - -## OSS-Fuzz logic - -The corresponding logic for Pacemaker on OSS-Fuzz can be found [here](https://github.com/google/oss-fuzz/tree/master/projects/pacemaker) diff --git a/fuzzers/cib_file_fuzzer.c b/fuzzers/cib_file_fuzzer.c deleted file mode 100644 index 1bd1d2b877..0000000000 --- a/fuzzers/cib_file_fuzzer.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2024 the Pacemaker project contributors - * - * The version control history for this file may have further details. - * - * This source code is licensed under the GNU Lesser General Public License - * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. - */ - -#include -#include -#include - -#include -#include - -int -LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) -{ - char *filename = NULL; - int fd = 0; - - // Have at least some data - if (size < 5) { - return -1; // Do not add input to testing corpus - } - - filename = crm_strdup_printf("%s/libfuzzer.XXXXXX", pcmk__get_tmpdir()); - fd = mkstemp(filename); - if (fd == -1) { - free(filename); - return 0; - } - if (write(fd, data, size) < 0) { - close(fd); - unlink(filename); - free(filename); - return 0; - } - close(fd); - - cib_file_read_and_verify(filename, NULL, NULL); - - unlink(filename); - free(filename); - - return 0; -} diff --git a/fuzzers/iso8601_fuzzer.c b/fuzzers/iso8601_fuzzer.c deleted file mode 100644 index 0e151c6dbd..0000000000 --- a/fuzzers/iso8601_fuzzer.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2024 the Pacemaker project contributors - * - * The version control history for this file may have further details. - * - * This source code is licensed under the GNU Lesser General Public License - * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. - */ - -#include -#include -#include - -#include -#include - -int -LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) -{ - char *ns = NULL; - char *result = NULL; - time_t epoch = 0; - pcmk__time_hr_t *now = NULL; - crm_time_period_t *period = NULL; - - // Ensure we have enough data. - if (size < 10) { - return -1; // Do not add input to testing corpus - } - ns = pcmk__assert_alloc(1, size + 1); - memcpy(ns, data, size); - - period = crm_time_parse_period(ns); - crm_time_free_period(period); - - now = pcmk__time_hr_new(ns); - pcmk__time_hr_free(now); - - now = pcmk__time_hr_now(&epoch); - result = pcmk__time_format_hr(ns, now); - pcmk__time_hr_free(now); - free(result); - - free(ns); - return 0; -} diff --git a/fuzzers/strings_fuzzer.c b/fuzzers/strings_fuzzer.c deleted file mode 100644 index f8dfc8e39f..0000000000 --- a/fuzzers/strings_fuzzer.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2024 the Pacemaker project contributors - * - * The version control history for this file may have further details. - * - * This source code is licensed under the GNU Lesser General Public License - * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. - */ - -#include -#include -#include -#include -#include - -#include -#include -#include - -int -LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) -{ - char *ns = NULL; - guint res = 0U; - - if (size < 10) { - return -1; // Do not add input to testing corpus - } - ns = pcmk__assert_alloc(1, size + 1); - memcpy(ns, data, size); - ns[size] = '\0'; - - pcmk__numeric_strcasecmp(ns, ns); - pcmk__trim(ns); - pcmk_parse_interval_spec(ns, &res); - crm_get_msec(ns); - - free(ns); - return 0; -} diff --git a/fuzzers/utils_fuzzer.c b/fuzzers/utils_fuzzer.c deleted file mode 100644 index 2cb3a5339b..0000000000 --- a/fuzzers/utils_fuzzer.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2024 the Pacemaker project contributors - * - * The version control history for this file may have further details. - * - * This source code is licensed under the GNU Lesser General Public License - * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. - */ - -#include -#include -#include - -#include -#include - -int -LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) -{ - char *ns = NULL; - guint result = 0U; - - if (size < 10) { - return -1; // Do not add input to testing corpus - } - ns = pcmk__assert_alloc(1, size + 1); - memcpy(ns, data, size); - ns[size] = '\0'; - - pcmk_parse_interval_spec(ns, &result); - - free(ns); - return 0; -}