Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fuzz: use lower pcre limits #12350

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions src/detect-content.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,25 +453,6 @@ void SigParseRequiredContentSize(
*/
bool DetectContentPMATCHValidateCallback(const Signature *s)
{
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
bool has_pcre = false;
bool has_content = false;
for (SigMatch *sm = s->init_data->smlists[DETECT_SM_LIST_PMATCH]; sm != NULL; sm = sm->next) {
if (sm->type == DETECT_PCRE) {
has_pcre = true;
} else if (sm->type == DETECT_CONTENT) {
has_content = true;
break;
}
}
if (has_pcre && !has_content) {
// Fuzzing does not allow rules with pcre and without content on payload
// as it is known to be a bad rule for performance causing possible timeouts
// Engine analysis has more generic warn_pcre_no_content about this
return false;
}
#endif

if (!(s->flags & SIG_FLAG_DSIZE)) {
return true;
}
Expand Down
5 changes: 5 additions & 0 deletions src/detect-pcre.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@

#define DETECT_PCRE_CAPTURE_MAX 8

#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
#define SC_MATCH_LIMIT_DEFAULT 350
#define SC_MATCH_LIMIT_RECURSION_DEFAULT 150
#else
#define SC_MATCH_LIMIT_DEFAULT 3500
#define SC_MATCH_LIMIT_RECURSION_DEFAULT 1500
#endif

typedef struct DetectPcreData_ {
DetectParseRegex parse_regex;
Expand Down
Loading