From 9ef082d8be63b1ab652cad0b828b530ffa7a23ad Mon Sep 17 00:00:00 2001 From: davkor Date: Mon, 22 Feb 2021 09:54:43 +0000 Subject: [PATCH 1/2] Added fuzzer for oss-fuzz integration. --- fuzz/fuzz_mms_decode.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 fuzz/fuzz_mms_decode.c diff --git a/fuzz/fuzz_mms_decode.c b/fuzz/fuzz_mms_decode.c new file mode 100644 index 00000000..6c4e4530 --- /dev/null +++ b/fuzz/fuzz_mms_decode.c @@ -0,0 +1,15 @@ +#include +#include + +#include "iec61850_server.h" +#include "hal_thread.h" + +int LLVMFuzzerTestOneInput(const char *data, size_t size) { + int out; + MmsValue* value = NULL; + value = MmsValue_decodeMmsData(data, 0, size, &out); + if (value != NULL) { + free(value); + } + return 0; +} From 6fe97b539f4b723740b35781ae61b49a7453145e Mon Sep 17 00:00:00 2001 From: davkor Date: Mon, 22 Feb 2021 09:57:16 +0000 Subject: [PATCH 2/2] Change tabs to spaces. --- fuzz/fuzz_mms_decode.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fuzz/fuzz_mms_decode.c b/fuzz/fuzz_mms_decode.c index 6c4e4530..f29831ad 100644 --- a/fuzz/fuzz_mms_decode.c +++ b/fuzz/fuzz_mms_decode.c @@ -5,11 +5,11 @@ #include "hal_thread.h" int LLVMFuzzerTestOneInput(const char *data, size_t size) { - int out; - MmsValue* value = NULL; - value = MmsValue_decodeMmsData(data, 0, size, &out); - if (value != NULL) { - free(value); - } - return 0; + int out; + MmsValue* value = NULL; + value = MmsValue_decodeMmsData(data, 0, size, &out); + if (value != NULL) { + free(value); + } + return 0; }