From 742b56a647514981f7f81b798470cbe750b7642e Mon Sep 17 00:00:00 2001 From: obdev Date: Tue, 26 Dec 2023 14:43:11 +0000 Subject: [PATCH] Fix bad annotation causing parser to hang --- src/sql/parser/ob_fast_parser.cpp | 2 +- src/sql/parser/ob_fast_parser.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sql/parser/ob_fast_parser.cpp b/src/sql/parser/ob_fast_parser.cpp index 207b9b6315..9a0eee0f8e 100644 --- a/src/sql/parser/ob_fast_parser.cpp +++ b/src/sql/parser/ob_fast_parser.cpp @@ -1181,7 +1181,7 @@ int64_t ObFastParserBase::is_hint_begin(int64_t pos) ch = raw_sql_.char_at(pos); next_ch = raw_sql_.char_at(++pos); // 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); next_ch = raw_sql_.char_at(++pos); } diff --git a/src/sql/parser/ob_fast_parser.h b/src/sql/parser/ob_fast_parser.h index 5b8b4dfda0..10c4da67ab 100644 --- a/src/sql/parser/ob_fast_parser.h +++ b/src/sql/parser/ob_fast_parser.h @@ -87,6 +87,10 @@ struct ObRawSql { { 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() { if (cur_pos_ >= raw_sql_len_ - 1) {