Issue #2685: Crash when distributing layers horizontally.

Make the returned values of g_list_length() a gint to avoid implicit
type conversion converting a possibly negative integer numberator into
unsigned int (which ends as a huge unsigned int instead of being
negative).

Found by Massimo!
This commit is contained in:
Jehan
2019-07-10 17:15:12 +02:00
parent b3f7f36bda
commit a6ad02a60a

View File

@ -158,14 +158,14 @@ gimp_image_arrange_objects (GimpImage *image,
(reference, "align-width"));
/* The offset parameter works as an internal margin */
fill_offset = (distr_width - 2 * offset) /
g_list_length (object_list);
(gint) g_list_length (object_list);
}
if (reference_alignment == GIMP_ARRANGE_VFILL)
{
distr_height = GPOINTER_TO_INT (g_object_get_data
(reference, "align-height"));
fill_offset = (distr_height - 2 * offset) /
g_list_length (object_list);
(gint) g_list_length (object_list);
}
/* FIXME: undo group type is wrong */