diff --git a/docs/env.md b/docs/env.md index 1e0205c2c..0085bec60 100644 --- a/docs/env.md +++ b/docs/env.md @@ -18,6 +18,7 @@ with a non-standard filesystem layout. * `FWUPD_DBUS_SOCKET` is used to set the socket filename if running without a dbus-daemon * `FWUPD_DOWNLOAD_VERBOSE` can be used to show wget or curl output * `FWUPD_PROFILE` can be used to set the profile traceback threshold value in ms +* `FWUPD_FUZZER_RUNNING` if the firmware format is being fuzzed * standard glibc variables like `LANG` are also honored for CLI tools that are translated * libcurl respects the session proxy, e.g. `http_proxy`, `all_proxy`, `sftp_proxy` and `no_proxy` diff --git a/libfwupdplugin/fu-fuzzer-firmware.c.in b/libfwupdplugin/fu-fuzzer-firmware.c.in index d7db2d208..bc1e84513 100644 --- a/libfwupdplugin/fu-fuzzer-firmware.c.in +++ b/libfwupdplugin/fu-fuzzer-firmware.c.in @@ -16,6 +16,7 @@ LLVMFuzzerTestOneInput(const guint8 *data, gsize size) gboolean ret; (void)g_setenv("G_DEBUG", "fatal-criticals", FALSE); + (void)g_setenv("FWUPD_FUZZER_RUNNING", "1", TRUE); ret = fu_firmware_parse(firmware, fw, FWUPD_INSTALL_FLAG_NONE, NULL); if (!ret && fu_firmware_has_flag(firmware, FU_FIRMWARE_FLAG_HAS_CHECKSUM)) { g_clear_object(&firmware); diff --git a/plugins/bcm57xx/fu-bcm57xx-dict-image.c b/plugins/bcm57xx/fu-bcm57xx-dict-image.c index a8b1b92bc..0a5c9c371 100644 --- a/plugins/bcm57xx/fu-bcm57xx-dict-image.c +++ b/plugins/bcm57xx/fu-bcm57xx-dict-image.c @@ -117,7 +117,8 @@ fu_bcm57xx_dict_image_ensure_id(FuBcm57xxDictImage *self) } } id = g_strdup_printf("dict-%02x-%02x", self->target, self->kind); - g_warning("falling back to %s, please report", id); + if (g_getenv("FWUPD_FUZZER_RUNNING") == NULL) + g_warning("falling back to %s, please report", id); fu_firmware_set_id(FU_FIRMWARE(self), id); } diff --git a/plugins/uf2/fu-uf2-firmware.c b/plugins/uf2/fu-uf2-firmware.c index 0e76f6143..1b6444407 100644 --- a/plugins/uf2/fu-uf2-firmware.c +++ b/plugins/uf2/fu-uf2-firmware.c @@ -198,7 +198,8 @@ fu_uf2_firmware_parse_chunk(FuUf2Firmware *self, FuChunk *chk, GByteArray *tmp, return FALSE; fu_firmware_set_id(FU_FIRMWARE(self), utf8buf); } else { - g_warning("unknown tag 0x%06x", tag); + if (g_getenv("FWUPD_FUZZER_RUNNING") == NULL) + g_warning("unknown tag 0x%06x", tag); } /* next! */