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.
This commit is contained in:
Benno Schulenberg 2022-09-28 16:21:10 +02:00
parent 119ec47072
commit d4d2840f5d

View File

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