[gimp/gimp-2-10] Issue #2685: Crash when distributing layers horizontally.



commit 3242eeb527736cc277ccd7dcad68a8f07b56b7b8
Author: Jehan <jehan girinstud io>
Date:   Wed Jul 10 17:15:12 2019 +0200

    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!
    
    (cherry picked from commit a6ad02a60a35cef748b02e1cf09804a5375b447c)

 app/core/gimpimage-arrange.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/app/core/gimpimage-arrange.c b/app/core/gimpimage-arrange.c
index 9d7021055a..6b6b05ee82 100644
--- a/app/core/gimpimage-arrange.c
+++ b/app/core/gimpimage-arrange.c
@@ -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 */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]