tweaks: avoid the vague possibility of advancing beyond end-of-line
Like the other two fragments that advance over a zero-length match, also this fragment should avoid the possibility of stepping beyond the end of the line.
Этот коммит содержится в:
родитель
0508520b47
Коммит
7d3a555464
@ -2524,6 +2524,8 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col)
|
|||||||
|
|
||||||
/* If the match has length zero, advance over it. */
|
/* If the match has length zero, advance over it. */
|
||||||
if (match.rm_so == match.rm_eo) {
|
if (match.rm_so == match.rm_eo) {
|
||||||
|
if (line->data[index] == '\0')
|
||||||
|
break;
|
||||||
index = step_right(line->data, index);
|
index = step_right(line->data, index);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user