From: Philippe Antoine Date: Thu, 15 Oct 2020 20:50:42 +0000 (+0200) Subject: fuzz: improves detect proto target X-Git-Tag: suricata-6.0.1~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80dc6c6f1eac90e876575f6351839016e6c89dfb;p=thirdparty%2Fsuricata.git fuzz: improves detect proto target By mimicking assert message so as to clusterfuzz differentiates between failures --- diff --git a/src/tests/fuzz/fuzz_applayerprotodetectgetproto.c b/src/tests/fuzz/fuzz_applayerprotodetectgetproto.c index 4c6320879d..bca53e1488 100644 --- a/src/tests/fuzz/fuzz_applayerprotodetectgetproto.c +++ b/src/tests/fuzz/fuzz_applayerprotodetectgetproto.c @@ -64,7 +64,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) for (size_t i = 0; i < size-HEADER_LEN && i < PROTO_DETECT_MAX_LEN; i++) { alproto2 = AppLayerProtoDetectGetProto(alpd_tctx, f, data+HEADER_LEN, i, f->proto, data[0], &reverse); if (alproto2 != ALPROTO_UNKNOWN && alproto2 != alproto) { - printf("Assertion failure : With input length %"PRIuMAX", found %s instead of %s\n", (uintmax_t) i, AppProtoToString(alproto2), AppProtoToString(alproto)); + printf("Failed with input length %" PRIuMAX " versus %" PRIuMAX + ", found %s instead of %s\n", + (uintmax_t)i, (uintmax_t)size - HEADER_LEN, AppProtoToString(alproto2), + AppProtoToString(alproto)); + printf("Assertion failure: %s-%s\n", AppProtoToString(alproto2), + AppProtoToString(alproto)); + fflush(stdout); abort(); } }