]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/fuzz/fuzz-main.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 Copyright © 2018 Jonathan Rudenberg
6 #include "alloc-util.h"
11 /* This is a test driver for the systemd fuzzers that provides main function
12 * for regression testing outside of oss-fuzz (https://github.com/google/oss-fuzz)
14 * It reads files named on the command line and passes them one by one into the
15 * fuzzer that it is compiled into. */
17 int main(int argc
, char **argv
) {
22 log_set_max_level(LOG_DEBUG
);
23 log_parse_environment();
26 for (i
= 1; i
< argc
; i
++) {
27 _cleanup_free_
char *buf
= NULL
;
30 r
= read_full_file(name
, &buf
, &size
);
32 log_error_errno(r
, "Failed to open '%s': %m", name
);
35 printf("%s... ", name
);
37 (void) LLVMFuzzerTestOneInput((uint8_t*)buf
, size
);