plug-ins: fix possible integer overflow on large images in jigsaw

Make sure we use gsize for intermediate results to not get integer
overflow on large image sizes.
This still is not ideal, but better than a crash, since we may (try to)
allocate a very large block of memory, which we should eventually fix
by looping over smaller size buffers.
This commit is contained in:
Jacob Boerema 2023-07-10 14:18:36 -04:00
parent 97a71cfd41
commit bbbd149ba3
1 changed files with 1 additions and 1 deletions

View File

@ -560,7 +560,7 @@ jigsaw (GObject *config,
bytes = babl_format_get_bytes_per_pixel (format);
/* setup image buffer */
buffer_size = bytes * width * height;
buffer_size = (gsize) bytes * width * height;
buffer = g_new (guchar, buffer_size);
gegl_buffer_get (gegl_buffer, GEGL_RECTANGLE (0, 0, width, height), 1.0,