-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Conversation
romange
commented
Feb 20, 2025
- cherry-pick valkey security fixes with stringmatchlen with exponential complexity of stars See https://nvd.nist.gov/vuln/detail/cve-2022-36021
- Fallback to stringmatchlen for short lengths.
- 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.
Is PCR Perl Compatible Regular Expressions ? Never heard of it so I wanted to check it out |
9b96a2c
to
a38a8bf
Compare
* have just determined that there is no match for the rest | ||
* of the pattern starting from anywhere in the current | ||
* string. */ | ||
*skipLongerMatches = 1; |
There was a problem hiding this comment.
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 *
?
There was a problem hiding this comment.
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.
src/core/glob_matcher.h
Outdated
#define FIX_PERFORMANCE_MATCHING | ||
|
||
#ifndef FIX_PERFORMANCE_MATCHING |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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]>