1
1

filtering: when returning to a line number, ensure it is within range

The function line_from_number() can handle only line numbers that exist,
and will crash otherwise.  (The lack of checks makes the function fast.)

This fixes https://savannah.gnu.org/bugs/?63120.

Bug existed since commit d1e28417 from five weeks ago.
Этот коммит содержится в:
Benno Schulenberg 2022-09-28 16:21:10 +02:00
родитель 119ec47072
Коммит d4d2840f5d

Просмотреть файл

@ -747,7 +747,11 @@ void goto_line_posx(ssize_t linenumber, size_t pos_x)
recook |= perturbed;
#endif
openfile->current = line_from_number(linenumber);
if (linenumber < openfile->filebot->lineno)
openfile->current = line_from_number(linenumber);
else
openfile->current = openfile->filebot;
openfile->current_x = pos_x;
openfile->placewewant = xplustabs();