mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Fixed another case; added a test
This commit is contained in:
parent
b133ea85b4
commit
c80aeb0ef1
@ -139,6 +139,7 @@ bool ParserLeftAssociativeBinaryOperatorList::parseImpl(Pos & pos, ASTPtr & node
|
||||
{
|
||||
bool first = true;
|
||||
|
||||
auto current_depth = pos.depth;
|
||||
while (1)
|
||||
{
|
||||
if (first)
|
||||
@ -190,10 +191,14 @@ bool ParserLeftAssociativeBinaryOperatorList::parseImpl(Pos & pos, ASTPtr & node
|
||||
++pos;
|
||||
}
|
||||
|
||||
/// Left associative operator chain is parsed as a tree: ((((1 + 1) + 1) + 1) + 1)...
|
||||
/// We must account it's depth - otherwise we may end up with stack overflow later - on destruction of AST.
|
||||
pos.increaseDepth();
|
||||
node = function;
|
||||
}
|
||||
}
|
||||
|
||||
pos.depth = current_depth;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
exceeded
|
||||
exceeded
|
||||
exceeded
|
||||
exceeded
|
||||
20002
|
||||
1
|
||||
|
@ -7,6 +7,8 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
perl -e 'print "(" x 10000' | $CLICKHOUSE_CURL -sS "$CLICKHOUSE_URL" --data-binary @- | grep -oF 'exceeded'
|
||||
perl -e 'print "SELECT " . ("[" x 10000)' | $CLICKHOUSE_CURL -sS "$CLICKHOUSE_URL" --data-binary @- | grep -oF 'exceeded'
|
||||
perl -e 'print "SELECT " . ("([" x 5000)' | $CLICKHOUSE_CURL -sS "$CLICKHOUSE_URL" --data-binary @- | grep -oF 'exceeded'
|
||||
perl -e 'print "SELECT 1" . ("+1" x 10000)' | $CLICKHOUSE_CURL -sS "$CLICKHOUSE_URL" --data-binary @- | grep -oF 'exceeded'
|
||||
|
||||
# But this is Ok
|
||||
perl -e 'print "SELECT 1" . (",1" x 10000)' | $CLICKHOUSE_CURL -sS "$CLICKHOUSE_URL" --data-binary @- | wc -c
|
||||
perl -e 'print "SELECT 1" . (" OR 1" x 10000)' | $CLICKHOUSE_CURL -sS "$CLICKHOUSE_URL" --data-binary @-
|
||||
|
Loading…
Reference in New Issue
Block a user