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

fix: performance degradation with Reflex matching #4634

Merged
merged 1 commit into from
Feb 24, 2025
Merged

fix: performance degradation with Reflex matching #4634

merged 1 commit into from
Feb 24, 2025

Conversation

romange
Copy link
Collaborator

@romange romange commented Feb 20, 2025

  1. cherry-pick valkey security fixes with stringmatchlen with exponential complexity of stars See https://nvd.nist.gov/vuln/detail/cve-2022-36021
  2. Fallback to stringmatchlen for short lengths.
  3. Add another backend to GlobMatcher - PCRE2, though do not enable at the moment. While this backend is the fastest one - it requires an additional shared lib dependency.

@kostasrim
Copy link
Contributor

Is PCR Perl Compatible Regular Expressions ? Never heard of it so I wanted to check it out

@romange romange force-pushed the Pr5 branch 2 times, most recently from 9b96a2c to a38a8bf Compare February 20, 2025 15:16
* have just determined that there is no match for the rest
* of the pattern starting from anywhere in the current
* string. */
*skipLongerMatches = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this used as a bool but is marked as int and passed as int * ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's taken from valkey codebase.

Comment on lines 11 to 13
#define FIX_PERFORMANCE_MATCHING

#ifndef FIX_PERFORMANCE_MATCHING
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You first define FIX_PERFORMANCE and then you ifndef it. Isn't that a bug ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIX_PERFORMANCE is a bad name.

it should be REFLEX_PERFORMANCE

1. cherry-pick valkey security fixes with stringmatchlen with exponential complexity of stars
   See https://nvd.nist.gov/vuln/detail/cve-2022-36021
2. Fallback to stringmatchlen for short lengths.
3. Add another backend to GlobMatcher - PCRE2, though do not enable at the moment.
   While this backend is the fastest one - it requires an additional shared lib dependency.

Signed-off-by: Roman Gershman <[email protected]>
@romange romange merged commit 2d8c5b8 into main Feb 24, 2025
10 checks passed
@romange romange deleted the Pr5 branch February 24, 2025 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants