From: Yu Watanabe Date: Fri, 17 Nov 2023 17:09:04 +0000 (+0900) Subject: fuzz: always call fuzz_setup_logging() X-Git-Tag: v255-rc3~42^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5acea42501a36bbfe322e8c22a3d2f3347bb9a38;p=thirdparty%2Fsystemd.git fuzz: always call fuzz_setup_logging() --- diff --git a/src/boot/efi/fuzz-bcd.c b/src/boot/efi/fuzz-bcd.c index 297b71f60cd..cb5be7a9b77 100644 --- a/src/boot/efi/fuzz-bcd.c +++ b/src/boot/efi/fuzz-bcd.c @@ -12,6 +12,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (outside_size_range(size, 0, 100*1024)) return 0; + fuzz_setup_logging(); + p = memdup(data, size); assert_se(p); diff --git a/src/boot/efi/fuzz-efi-osrel.c b/src/boot/efi/fuzz-efi-osrel.c index 900e65bd3c2..1a5a9bc3fe7 100644 --- a/src/boot/efi/fuzz-efi-osrel.c +++ b/src/boot/efi/fuzz-efi-osrel.c @@ -12,6 +12,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (data[SEP_LEN] != '\0') return 0; + fuzz_setup_logging(); + _cleanup_free_ char *p = memdup_suffix0(data + SEP_LEN + 1, size - SEP_LEN - 1); assert_se(p); diff --git a/src/boot/efi/fuzz-efi-printf.c b/src/boot/efi/fuzz-efi-printf.c index 218a427cef5..6dee830c14c 100644 --- a/src/boot/efi/fuzz-efi-printf.c +++ b/src/boot/efi/fuzz-efi-printf.c @@ -42,6 +42,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { const Input *i = (const Input *) data; size_t len = size - offsetof(Input, str); + fuzz_setup_logging(); + PRINTF_ONE(i->status, "%*.*s", i->field_width, (int) len, i->str); PRINTF_ONE(i->status, "%*.*ls", i->field_width, (int) (len / sizeof(wchar_t)), (const wchar_t *) i->str); diff --git a/src/boot/efi/fuzz-efi-string.c b/src/boot/efi/fuzz-efi-string.c index 3c0f0f34b4c..36ecaf90ae8 100644 --- a/src/boot/efi/fuzz-efi-string.c +++ b/src/boot/efi/fuzz-efi-string.c @@ -16,6 +16,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (outside_size_range(size, sizeof(size_t), 64 * 1024)) return 0; + fuzz_setup_logging(); + size_t len, len2; memcpy(&len, data, sizeof(len)); data += sizeof(len); diff --git a/src/udev/fuzz-udev-rule-parse-value.c b/src/udev/fuzz-udev-rule-parse-value.c index c7b85044cd5..1817c15b3b4 100644 --- a/src/udev/fuzz-udev-rule-parse-value.c +++ b/src/udev/fuzz-udev-rule-parse-value.c @@ -12,6 +12,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { char *value = UINT_TO_PTR(0x12345678U); char *endpos = UINT_TO_PTR(0x87654321U); + fuzz_setup_logging(); + assert_se(str = malloc(size + 1)); memcpy(str, data, size); str[size] = '\0';