Merge branch '2.3' into develop
This commit is contained in:
@ -1465,7 +1465,11 @@ std::string get_canonical(GWBUF* querybuf)
|
||||
else if (*it == '/' && is_next(it, buf.end(), "/*"))
|
||||
{
|
||||
auto comment_start = std::next(it, 2);
|
||||
if (comment_start != buf.end() && *comment_start != '!' && *comment_start != 'M')
|
||||
if (comment_start == buf.end())
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (*comment_start != '!' && *comment_start != 'M')
|
||||
{
|
||||
// Non-executable comment
|
||||
while (it != buf.end())
|
||||
@ -1478,6 +1482,11 @@ std::string get_canonical(GWBUF* querybuf)
|
||||
}
|
||||
++it;
|
||||
}
|
||||
|
||||
if (it == buf.end())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1506,6 +1515,7 @@ std::string get_canonical(GWBUF* querybuf)
|
||||
|
||||
++it;
|
||||
}
|
||||
|
||||
if (it == buf.end())
|
||||
{
|
||||
break;
|
||||
@ -1529,13 +1539,19 @@ std::string get_canonical(GWBUF* querybuf)
|
||||
else if (*it == '\'' || *it == '"')
|
||||
{
|
||||
char c = *it;
|
||||
it = find_char(std::next(it), buf.end(), c);
|
||||
if ((it = find_char(std::next(it), buf.end(), c)) == buf.end())
|
||||
{
|
||||
break;
|
||||
}
|
||||
rval[i++] = '?';
|
||||
}
|
||||
else if (*it == '`')
|
||||
{
|
||||
auto start = it;
|
||||
it = find_char(std::next(it), buf.end(), '`');
|
||||
if ((it = find_char(std::next(it), buf.end(), '`')) == buf.end())
|
||||
{
|
||||
break;
|
||||
}
|
||||
std::copy(start, it, &rval[i]);
|
||||
i += std::distance(start, it);
|
||||
rval[i++] = '`';
|
||||
@ -1544,6 +1560,8 @@ std::string get_canonical(GWBUF* querybuf)
|
||||
{
|
||||
rval[i++] = *it;
|
||||
}
|
||||
|
||||
mxb_assert(it != buf.end());
|
||||
}
|
||||
|
||||
// Shrink the buffer so that the internal bookkeeping of std::string remains up to date
|
||||
|
||||
Reference in New Issue
Block a user