Skip to content

Commit

Permalink
Backport #52451 to 23.3: Check recursion depth in OptimizedRegularExp…
Browse files Browse the repository at this point in the history
…ression
  • Loading branch information
robot-clickhouse committed Aug 30, 2023
1 parent 1a616ae commit e29beba
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 e29beba

Please sign in to comment.