Skip to content

Commit 11111df

Browse files
committed
fuzz/detect: forbid rule with any pcre on stream
to avoid fuzzing blocks on timeouts with known bad rules Completes commit 378f678 after oss-fuzz found another timeout Ticket: 4858
1 parent def22fa commit 11111df

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/detect-content.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -454,22 +454,14 @@ void SigParseRequiredContentSize(
454454
bool DetectContentPMATCHValidateCallback(const Signature *s)
455455
{
456456
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
457-
bool has_pcre = false;
458-
bool has_content = false;
459457
for (SigMatch *sm = s->init_data->smlists[DETECT_SM_LIST_PMATCH]; sm != NULL; sm = sm->next) {
460458
if (sm->type == DETECT_PCRE) {
461-
has_pcre = true;
462-
} else if (sm->type == DETECT_CONTENT) {
463-
has_content = true;
464-
break;
459+
// Fuzzing does not allow rules with pcre on payload
460+
// as it is known to be a bad rule for performance causing possible timeouts
461+
// Engine analysis has more generic warn_pcre_no_content about this
462+
return false;
465463
}
466464
}
467-
if (has_pcre && !has_content) {
468-
// Fuzzing does not allow rules with pcre and without content on payload
469-
// as it is known to be a bad rule for performance causing possible timeouts
470-
// Engine analysis has more generic warn_pcre_no_content about this
471-
return false;
472-
}
473465
#endif
474466

475467
if (!(s->flags & SIG_FLAG_DSIZE)) {

0 commit comments

Comments
 (0)