From: Benjamin Otte Date: Mon, 24 Jul 2023 14:12:51 +0000 (+0200) Subject: memorytexture: Add a check X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~21^2~7 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ae509406f19b7cb705eb910ebf37159065b564ce;p=gtk4.git memorytexture: Add a check Sophie Herold was running into this problem while coding, so let's help people by catching it early. --- diff --git a/gdk/gdkmemorytexture.c b/gdk/gdkmemorytexture.c index 85d9ba0a25..0e8e2cc78d 100644 --- a/gdk/gdkmemorytexture.c +++ b/gdk/gdkmemorytexture.c @@ -151,6 +151,8 @@ gdk_memory_texture_new (int width, g_return_val_if_fail (height > 0, NULL); g_return_val_if_fail (bytes != NULL, NULL); g_return_val_if_fail (stride >= width * gdk_memory_format_bytes_per_pixel (format), NULL); + /* needs to be this complex to support subtexture of the bottom right part */ + g_return_val_if_fail (g_bytes_get_size (bytes) >= stride * (height - 1) + width * gdk_memory_format_bytes_per_pixel (format), NULL); bytes = gdk_memory_sanitize (bytes, width, height, format, stride, &stride);