未验证 提交 2493eed1 编写于 作者: O openharmony_ci 提交者: Gitee

!29 【monthly】增加边界校验避免越界

Merge pull request !29 from fyz1019/cherry-pick-1673057465
......@@ -772,6 +772,10 @@ void Reader::getLocationLineAndColumn(Location location, int& line,
while (current < location && current != end_) {
Char c = *current++;
if (c == '\r') {
// Add boundary check to avoid cross the border
if (current == end_) {
break;
}
if (*current == '\n')
++current;
lastLineStart = current;
......@@ -1838,6 +1842,10 @@ void OurReader::getLocationLineAndColumn(Location location, int& line,
while (current < location && current != end_) {
Char c = *current++;
if (c == '\r') {
// Add boundary check to avoid cross the border
if (current == end_) {
break;
}
if (*current == '\n')
++current;
lastLineStart = current;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册