Skip to content

Commit

Permalink
Merge pull request #54073 from ClickHouse/backport/23.3/52451
Browse files Browse the repository at this point in the history
Backport #52451 to 23.3: Check recursion depth in OptimizedRegularExpression
  • Loading branch information
alexey-milovidov committed Sep 5, 2023
2 parents 5c2742e + e29beba commit 56aa26b
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 56aa26b

Please sign in to comment.