1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3 #include "alloc-util.h"
4 #include "fd-util.h"
5 #include "fuzz.h"
6 #include "time-util.h"
7 #include "util.h"
8
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)9 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
10 _cleanup_free_ char *str = NULL;
11 usec_t usec;
12
13 if (!getenv("SYSTEMD_LOG_LEVEL"))
14 log_set_max_level(LOG_CRIT);
15
16 str = memdup_suffix0(data, size);
17
18 (void) parse_timestamp(str, &usec);
19 (void) parse_sec(str, &usec);
20 (void) parse_sec_fix_0(str, &usec);
21 (void) parse_sec_def_infinity(str, &usec);
22 (void) parse_time(str, &usec, USEC_PER_SEC);
23 (void) parse_nsec(str, &usec);
24
25 (void) timezone_is_valid(str, LOG_DEBUG);
26
27 return 0;
28 }
29