From: Philippe Antoine Date: Mon, 6 Apr 2020 08:58:23 +0000 (+0200) Subject: fuzz: build compatibility with oss-fuzz flags X-Git-Tag: suricata-6.0.0-beta1~560 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91b29308916f4c3f6dd47f9c906dd12ac5ff6a06;p=thirdparty%2Fsuricata.git fuzz: build compatibility with oss-fuzz flags ie C define FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION --- diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index eb1ef119f9..cb10867fd4 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -6482,6 +6482,8 @@ static int HTPParserTest16(void) goto end; } +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION +//these events are disabled during fuzzing as they are too noisy and consume much resource FLOWLOCK_WRLOCK(f); void *txtmp = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP,f->alstate, 0); AppLayerDecoderEvents *decoder_events = AppLayerParserGetEventsByTx(IPPROTO_TCP, ALPROTO_HTTP, txtmp); @@ -6501,6 +6503,7 @@ static int HTPParserTest16(void) printf("HTTP_DECODER_EVENT_URI_DELIM_NON_COMPLIANT not set: "); goto end; } +#endif result = 1; end: diff --git a/src/suricata.c b/src/suricata.c index eb497c488a..0cc79eea5b 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -281,6 +281,7 @@ int RunmodeGetCurrent(void) * construction, etc. */ +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION static void SignalHandlerSigint(/*@unused@*/ int sig) { sigint_count = 1; @@ -289,6 +290,8 @@ static void SignalHandlerSigterm(/*@unused@*/ int sig) { sigterm_count = 1; } +#endif + #ifndef OS_WIN32 /** * SIGUSR2 handler. Just set sigusr2_count. The main loop will act on