Fix bad annotation causing parser to hang

This commit is contained in:
obdev
2023-12-26 14:43:11 +00:00
committed by ob-robot
parent fb0d870b15
commit 742b56a647
2 changed files with 5 additions and 1 deletions

View File

@ -1181,7 +1181,7 @@ int64_t ObFastParserBase::is_hint_begin(int64_t pos)
ch = raw_sql_.char_at(pos); ch = raw_sql_.char_at(pos);
next_ch = raw_sql_.char_at(++pos); next_ch = raw_sql_.char_at(++pos);
// check and ignore comment // check and ignore comment
while (ch != '*' && next_ch != '/' && !raw_sql_.is_search_end()) { while (ch != '*' && next_ch != '/' && !raw_sql_.is_search_end(pos)) {
ch = raw_sql_.char_at(pos); ch = raw_sql_.char_at(pos);
next_ch = raw_sql_.char_at(++pos); next_ch = raw_sql_.char_at(++pos);
} }

View File

@ -87,6 +87,10 @@ struct ObRawSql {
{ {
return search_end_ || cur_pos_ > raw_sql_len_ - 1; return search_end_ || cur_pos_ > raw_sql_len_ - 1;
} }
inline bool is_search_end(const int64_t pos)
{
return search_end_ || pos > raw_sql_len_ - 1;
}
inline char peek() inline char peek()
{ {
if (cur_pos_ >= raw_sql_len_ - 1) { if (cur_pos_ >= raw_sql_len_ - 1) {