From 47ae31eb5d3a51b849338b9d57f997e6d73c8523 Mon Sep 17 00:00:00 2001 From: lbonn Date: Wed, 6 Mar 2024 11:54:20 +0100 Subject: [PATCH] [Wayland] Fix CodeQL overflow warning --- source/wayland/display.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/wayland/display.c b/source/wayland/display.c index 65058d12e..ce7e7f9a9 100644 --- a/source/wayland/display.c +++ b/source/wayland/display.c @@ -166,7 +166,11 @@ wayland_buffer_pool *display_buffer_pool_new(gint width, gint height) { size_t pool_size; stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width); - size = stride * height; + if (stride < 0) { + g_warning("cairo stride width calculation failure"); + return NULL; + } + size = (size_t)stride * height; pool_size = size * wayland->buffer_count; gchar filename[PATH_MAX];