Skip to content

Avoid redundant operator invokation in multimatch rules #1087

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

Closed
Closed
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
7 changes: 5 additions & 2 deletions apache2/re.c
Original file line number Diff line number Diff line change
Expand Up @@ -2851,7 +2851,10 @@ static apr_status_t msre_rule_process_normal(msre_rule *rule, modsec_rec *msr) {
arr = apr_table_elts(tartab);
te = (apr_table_entry_t *)arr->elts;
for (i = 0; i < arr->nelts; i++) {
/* Variable was modified by *any* transformation */
int changed;
/* Variable was modified by *last applied* transformation (needed by multimatch) */
int tfnchanged;
int usecache = 0;
apr_table_t *cachetab = NULL;
apr_time_t time_before_trans = 0;
Expand Down Expand Up @@ -2974,8 +2977,8 @@ static apr_status_t msre_rule_process_normal(msre_rule *rule, modsec_rec *msr) {
apr_table_t *normtab;
const char *lastvarval = NULL;
apr_size_t lastvarlen = 0;
int tfnchanged = 0;

tfnchanged = 0;
changed = 0;
normtab = apr_table_make(mptmp, 10);
if (normtab == NULL) return -1;
Expand Down Expand Up @@ -3257,7 +3260,7 @@ static apr_status_t msre_rule_process_normal(msre_rule *rule, modsec_rec *msr) {
* or if it is and we need to process the result of the
* last transformation.
*/
if (!multi_match || changed) {
if (!multi_match || tfnchanged) {
invocations++;

#if defined(PERFORMANCE_MEASUREMENT)
Expand Down