mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Fix visitParamExtractRaw for strings with unbalanced { or [.
Closes #11254 .
This commit is contained in:
parent
a4b2daae0d
commit
70eaae38f2
@ -22,6 +22,14 @@ struct ExtractRaw
|
||||
expects_end.pop_back();
|
||||
current_expect_end = expects_end.empty() ? 0 : expects_end.back();
|
||||
}
|
||||
else if (current_expect_end == '"')
|
||||
{
|
||||
/// skip backslash
|
||||
if (*pos == '\\' && pos + 1 < end && pos[1] == '"')
|
||||
{
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (*pos)
|
||||
@ -38,11 +46,6 @@ struct ExtractRaw
|
||||
current_expect_end = '"';
|
||||
expects_end.push_back(current_expect_end);
|
||||
break;
|
||||
case '\\':
|
||||
/// skip backslash
|
||||
if (pos + 1 < end && pos[1] == '"')
|
||||
pos++;
|
||||
break;
|
||||
default:
|
||||
if (!current_expect_end && (*pos == ',' || *pos == '}'))
|
||||
{
|
||||
|
@ -9,5 +9,7 @@ test"string
|
||||
"test_string"
|
||||
"test\\"string"
|
||||
"test\\"string"
|
||||
"{"
|
||||
"["
|
||||
["]", "2", "3"]
|
||||
{"nested" : [1,2,3]}
|
||||
|
@ -11,5 +11,7 @@ SELECT visitParamExtractRaw('{"myparam":"test_string"}', 'myparam');
|
||||
SELECT visitParamExtractRaw('{"myparam": "test_string"}', 'myparam');
|
||||
SELECT visitParamExtractRaw('{"myparam": "test\\"string"}', 'myparam');
|
||||
SELECT visitParamExtractRaw('{"myparam": "test\\"string", "other":123}', 'myparam');
|
||||
SELECT visitParamExtractRaw('{"myparam": "{"}', 'myparam');
|
||||
SELECT visitParamExtractRaw('{"myparam": "["}', 'myparam');
|
||||
SELECT visitParamExtractRaw('{"myparam": ["]", "2", "3"], "other":123}', 'myparam');
|
||||
SELECT visitParamExtractRaw('{"myparam": {"nested" : [1,2,3]}, "other":123}', 'myparam');
|
||||
|
Loading…
Reference in New Issue
Block a user