From e02b8819e544885ddad8116abec3232c7388f3ec Mon Sep 17 00:00:00 2001 From: Jehan Date: Mon, 28 Oct 2024 02:03:57 +0100 Subject: [PATCH] =?UTF-8?q?app,=20libgimp,=20pdb:=20fix=20=E2=80=9CStack?= =?UTF-8?q?=20smashing=20detected=E2=80=9D=20crash.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Building with clang and various stack protection flags (as is done in our flatpak apparently), we can trigger a crash when a gint on the stack is set as a pointer to gsize. Anyway now all array size must be gsize. See: https://discourse.gnome.org/t/problem-with-select-polygon-in-gimp-2-99/24753 --- app/pdb/image-select-cmds.c | 2 +- libgimp/gimpimageselect_pdb.c | 2 +- libgimp/gimpimageselect_pdb.h | 2 +- pdb/groups/image_select.pdb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/pdb/image-select-cmds.c b/app/pdb/image-select-cmds.c index 7d80d35b76..988d86db41 100644 --- a/app/pdb/image-select-cmds.c +++ b/app/pdb/image-select-cmds.c @@ -290,7 +290,7 @@ image_select_polygon_invoker (GimpProcedure *procedure, gboolean success = TRUE; GimpImage *image; gint operation; - gint num_segs; + gsize num_segs; const gdouble *segs; image = g_value_get_object (gimp_value_array_index (args, 0)); diff --git a/libgimp/gimpimageselect_pdb.c b/libgimp/gimpimageselect_pdb.c index 8a7d8c75de..203e1788da 100644 --- a/libgimp/gimpimageselect_pdb.c +++ b/libgimp/gimpimageselect_pdb.c @@ -372,7 +372,7 @@ gimp_image_select_ellipse (GimpImage *image, gboolean gimp_image_select_polygon (GimpImage *image, GimpChannelOps operation, - gint num_segs, + gsize num_segs, const gdouble *segs) { GimpValueArray *args; diff --git a/libgimp/gimpimageselect_pdb.h b/libgimp/gimpimageselect_pdb.h index 0848082813..dc8b887a9f 100644 --- a/libgimp/gimpimageselect_pdb.h +++ b/libgimp/gimpimageselect_pdb.h @@ -63,7 +63,7 @@ gboolean gimp_image_select_ellipse (GimpImage *image, gdouble height); gboolean gimp_image_select_polygon (GimpImage *image, GimpChannelOps operation, - gint num_segs, + gsize num_segs, const gdouble *segs); gboolean gimp_image_select_item (GimpImage *image, GimpChannelOps operation, diff --git a/pdb/groups/image_select.pdb b/pdb/groups/image_select.pdb index 1066450392..9e4f4c1267 100644 --- a/pdb/groups/image_select.pdb +++ b/pdb/groups/image_select.pdb @@ -351,7 +351,7 @@ HELP { name => 'segs', type => 'floatarray', desc => 'Array of points: { p1.x, p1.y, p2.x, p2.y, ..., pn.x, pn.y}', - array => { type => '2 <= int32', + array => { type => '2 <= size', desc => 'Number of points (count 1 coordinate as two points)' } } );