From 8dac6927be175a267cb11d71a759a3598902f213 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 3 Aug 2022 13:27:48 +0000 Subject: [PATCH] Do not crash when searching for .* with extremely long lines. Reported by Torbjorn Lonnemark, GitHub issue 3272. --- usr.bin/tmux/window-copy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 830b006b5f7..f6bb56f2b09 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.337 2022/07/22 07:14:07 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.338 2022/08/03 13:27:48 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -3673,6 +3673,7 @@ window_copy_search(struct window_mode_entry *wme, int direction, int regex) if (direction && window_copy_search_mark_at(data, fx, fy, &at) == 0 && at > 0 && + data->searchmark != NULL && data->searchmark[at] == data->searchmark[at - 1]) { window_copy_move_after_search_mark(data, &fx, &fy, wrapflag); @@ -3705,6 +3706,7 @@ window_copy_search(struct window_mode_entry *wme, int direction, int regex) &start) == 0) { while (window_copy_search_mark_at(data, fx, fy, &at) == 0 && + data->searchmark != NULL && data->searchmark[at] == data->searchmark[start]) { data->cx = fx; -- 2.20.1