From 3da6fac1f21aa12eeeb55b44b3e1c16b637201f5 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 29 Sep 2024 16:35:33 +0200 Subject: [PATCH] render/vulkan: check size when creating shm texture --- render/vulkan/texture.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/render/vulkan/texture.c b/render/vulkan/texture.c index 2a4f60c57..e3bd69793 100644 --- a/render/vulkan/texture.c +++ b/render/vulkan/texture.c @@ -390,6 +390,12 @@ static struct wlr_texture *vulkan_texture_from_pixels( return NULL; } + if (width > fmt->shm.max_extent.width || height > fmt->shm.max_extent.height) { + wlr_log(WLR_ERROR, "Texture is too large to upload (%"PRIu32"x%"PRIu32" > %"PRIu32"x%"PRIu32")", + width, height, fmt->shm.max_extent.width, fmt->shm.max_extent.height); + return NULL; + } + struct wlr_vk_texture *texture = vulkan_texture_create(renderer, width, height); if (texture == NULL) { return NULL;