Skip to content

Commit

Permalink
sam: reject invalid ranges for cmd_extract ("x"/"y")
Browse files Browse the repository at this point in the history
fixes martanne#1152: `:2x/foo/<cr>` in a file with only one line makes vis
get stuck in an infinite loop
  • Loading branch information
rnpnr committed Oct 23, 2023
1 parent 045ef7a commit 18c72a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sam.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ static int extract(Vis *vis, Win *win, Command *cmd, const char *argv[], Selecti
}

static bool cmd_extract(Vis *vis, Win *win, Command *cmd, const char *argv[], Selection *sel, Filerange *range) {
if (!win)
if (!win || !text_range_valid(range))
return false;
int matches = 0;
if (count_negative(cmd->cmd))
Expand Down

0 comments on commit 18c72a1

Please sign in to comment.