Skip to content

Commit

Permalink
Merge pull request #52451 from ClickHouse/fix-optimized-regular-expre…
Browse files Browse the repository at this point in the history
…ssion

Check recursion depth in OptimizedRegularExpression
  • Loading branch information
hanfei1991 committed Jul 22, 2023
2 parents db9c7c4 + 21ffce0 commit 2e67a89
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Common/OptimizedRegularExpression.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <limits>
#include <Common/Exception.h>
#include <Common/PODArray.h>
#include <Common/checkStackSize.h>
#include <Common/OptimizedRegularExpression.h>

#define MIN_LENGTH_FOR_STRSTR 3
Expand Down Expand Up @@ -50,6 +51,8 @@ const char * analyzeImpl(
bool & is_trivial,
Literals & global_alternatives)
{
checkStackSize();

/** The expression is trivial if all the metacharacters in it are escaped.
* The non-alternative string is
* a string outside parentheses,
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SELECT match('', repeat('(', 100000)); -- { serverError 306 }

0 comments on commit 2e67a89

Please sign in to comment.