fix use-after-free at syntax error

This commit is contained in:
Anton Popov 2020-03-31 22:25:00 +03:00
parent 9e5d82641f
commit 6e305b2ec1
3 changed files with 10 additions and 2 deletions

View File

@ -1026,8 +1026,7 @@ bool ParserCollectionOfLiterals<Collection>::parseImpl(Pos & pos, ASTPtr & node,
} }
else else
{ {
String message = String("comma or ") + getTokenName(closing_bracket); expected.add(pos, "comma or closing bracket");
expected.add(pos, message.c_str());
return false; return false;
} }
} }

View File

@ -0,0 +1,2 @@
Syntax error
Syntax error

View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
$CLICKHOUSE_CLIENT -q "SELECT (1, 2 2)" 2>&1 | grep -o "Syntax error"
$CLICKHOUSE_CLIENT -q "SELECT [1, 2 2]" 2>&1 | grep -o "Syntax error"