From 47263aca289ab4d89ba69a543357603e64719ff6 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Tue, 24 Oct 2023 15:24:51 +0300 Subject: [PATCH] view: check if the buffer was uploaded on save wlr_surface_has_buffer() is insufficient; if a client has committed a buffer but it couldn't be applied, NULL deref happens in the next line. --- sway/tree/view.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway/tree/view.c b/sway/tree/view.c index ec54fed8..a9035de7 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -1422,7 +1422,7 @@ static void view_save_buffer_iterator(struct wlr_surface *surface, int sx, int sy, void *data) { struct sway_view *view = data; - if (surface && wlr_surface_has_buffer(surface)) { + if (surface && surface->buffer) { wlr_buffer_lock(&surface->buffer->base); struct sway_saved_buffer *saved_buffer = calloc(1, sizeof(struct sway_saved_buffer)); saved_buffer->buffer = surface->buffer;