/src/numactl/fuzz/fuzz_parse_str.c
Line | Count | Source |
1 | | #include <stdint.h> |
2 | | #include <stdlib.h> |
3 | | #include "numa.h" |
4 | | |
5 | | |
6 | 897 | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { |
7 | 897 | struct bitmask *mask = NULL; |
8 | | |
9 | 897 | char *fuzz_str1 = malloc(size+1); |
10 | 897 | memcpy(fuzz_str1, data, size); |
11 | 897 | fuzz_str1[size] = '\0'; |
12 | | |
13 | 897 | mask = numa_parse_nodestring(fuzz_str1); |
14 | 897 | if (mask != NULL) { |
15 | 38 | numa_bitmask_free(mask); |
16 | 38 | } |
17 | | |
18 | | // NULLify the mask variable before we use it again. |
19 | 897 | mask = NULL; |
20 | 897 | mask = numa_parse_cpustring(fuzz_str1); |
21 | 897 | if (mask != NULL) { |
22 | 132 | numa_node_to_cpus_v2(0, mask); |
23 | 132 | numa_bitmask_free(mask); |
24 | 132 | } |
25 | | |
26 | 897 | free(fuzz_str1); |
27 | 897 | return 0; |
28 | 897 | } |