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 "utf8.h" 7 8 #include "bcd.c" 9 LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)10int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { 11 _cleanup_free_ void *p = NULL; 12 13 /* This limit was borrowed from src/boot/efi/boot.c */ 14 if (outside_size_range(size, 0, 100*1024)) 15 return 0; 16 17 if (!getenv("SYSTEMD_LOG_LEVEL")) 18 log_set_max_level(LOG_CRIT); 19 20 p = memdup(data, size); 21 assert_se(p); 22 23 char16_t *title = get_bcd_title(p, size); 24 if (title) 25 (void) char16_strlen(title); 26 return 0; 27 } 28