fuzz: add bus-label fuzzer

This commit is contained in:
Frantisek Sumsal
2019-03-10 20:53:57 +01:00
parent 68b7f7ac89
commit e5f274bee1
2 changed files with 22 additions and 0 deletions

18
src/fuzz/fuzz-bus-label.c Normal file
View File

@@ -0,0 +1,18 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <errno.h>
#include "alloc-util.h"
#include "bus-label.h"
#include "fuzz.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
_cleanup_free_ char *unescaped = NULL, *escaped = NULL;
unescaped = bus_label_unescape_n((const char*)data, size);
assert_se(unescaped != NULL);
escaped = bus_label_escape(unescaped);
assert_se(escaped != NULL);
return 0;
}

View File

@@ -112,4 +112,8 @@ fuzzers += [
[['src/fuzz/fuzz-compress.c'],
[libshared],
[]],
[['src/fuzz/fuzz-bus-label.c'],
[libshared],
[]],
]