src/nspawn/fuzz-nspawn-oci.c
raw| 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 | |
| 3 | #include "fd-util.h" |
| 4 | #include "fuzz.h" |
| 5 | #include "nspawn-oci.h" |
| 6 | |
| 7 | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { |
| 8 | _cleanup_fclose_ FILE *f = NULL; |
| 9 | _cleanup_(settings_freep) Settings *s = NULL; |
| 10 | |
| 11 | if (outside_size_range(size, 0, 65536)) |
| 12 | return 0; |
| 13 | |
| 14 | f = data_to_file(data, size); |
| 15 | assert_se(f); |
| 16 | |
| 17 | fuzz_setup_logging(); |
| 18 | |
| 19 | (void) oci_load(f, "/dev/null", &s); |
| 20 | |
| 21 | return 0; |
| 22 | } |