From 792b4439185808f90d25bf70ebc91deb4f30c003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 3 Jan 2020 12:05:48 +0100 Subject: [PATCH] render: use a unique buffer cookie for the 'search' surface This fixes an issue where rendering the 'search' box caused the last normal buffer from being purged. This meant the terminal had a pointer to a now freed buffer, which we de-referenced and occasionally memcpy:ied from. --- render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/render.c b/render.c index 97284cbb..137e98b4 100644 --- a/render.c +++ b/render.c @@ -886,7 +886,7 @@ render_search_box(struct terminal *term) const int width = min(term->width, 2 * margin + max(20, term->search.len) * term->cell_width); const int height = min(term->height, 2 * margin + 1 * term->cell_height); - unsigned long cookie = (uintptr_t)term; + unsigned long cookie = (uintptr_t)term + 1; struct buffer *buf = shm_get_buffer(term->wl->shm, width, height, cookie); /* Background - yellow on empty/match, red on mismatch */