summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-11-17 18:09:04 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-11-17 19:04:27 +0100
commit5acea42501a36bbfe322e8c22a3d2f3347bb9a38 (patch)
treee80e3a028c96bd51decf9d6a8b69e3d5953bf51a
parenttest: always call test_setup_logging() (diff)
downloadsystemd-5acea42501a36bbfe322e8c22a3d2f3347bb9a38.tar.xz
systemd-5acea42501a36bbfe322e8c22a3d2f3347bb9a38.zip
fuzz: always call fuzz_setup_logging()
-rw-r--r--src/boot/efi/fuzz-bcd.c2
-rw-r--r--src/boot/efi/fuzz-efi-osrel.c2
-rw-r--r--src/boot/efi/fuzz-efi-printf.c2
-rw-r--r--src/boot/efi/fuzz-efi-string.c2
-rw-r--r--src/udev/fuzz-udev-rule-parse-value.c2
5 files changed, 10 insertions, 0 deletions
diff --git a/src/boot/efi/fuzz-bcd.c b/src/boot/efi/fuzz-bcd.c
index 297b71f60c..cb5be7a9b7 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 900e65bd3c..1a5a9bc3fe 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 218a427cef..6dee830c14 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 3c0f0f34b4..36ecaf90ae 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 c7b85044cd..1817c15b3b 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';