This source file includes following definitions.
- LLVMFuzzerTestOneInput
1
2
3
4
5
6
7
8
9
10 #include <stdint.h>
11 #include <stdlib.h>
12 #include <stdio.h>
13
14 #include <crm/common/util.h>
15 #include <crm/common/internal.h>
16
17 int
18 LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
19 {
20 char *ns = NULL;
21 char *result = NULL;
22 time_t epoch = 0;
23 pcmk__time_hr_t *now = NULL;
24 crm_time_period_t *period = NULL;
25
26
27 if (size < 10) {
28 return -1;
29 }
30 ns = pcmk__assert_alloc(1, size + 1);
31 memcpy(ns, data, size);
32
33 period = crm_time_parse_period(ns);
34 crm_time_free_period(period);
35
36 now = pcmk__time_hr_new(ns);
37 pcmk__time_hr_free(now);
38
39 now = pcmk__time_hr_now(&epoch);
40 result = pcmk__time_format_hr(ns, now);
41 pcmk__time_hr_free(now);
42 free(result);
43
44 free(ns);
45 return 0;
46 }