From 33011ccdff4a0167de1d1fe415819736cf97875f Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Wed, 13 May 2020 20:32:30 -0400
Subject: flowbox: Avoid a crash in measure()

When the children request a height of zero, the
flowbox measure() function was happily dividing
by that zero, leading to badness.
---
 gtk/gtkflowbox.c | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'gtk')

diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 26b78e3fa3..5c022d45cd 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -2075,6 +2075,8 @@ gtk_flow_box_measure (GtkWidget      *widget,
                 goto out_width;
 
               get_max_item_size (box, GTK_ORIENTATION_VERTICAL, &min_item_height, &nat_item_height);
+              if (nat_item_height <= 0)
+                goto out_width;
 
               /* By default flow at the natural item width */
               line_length = avail_size / (nat_item_height + priv->row_spacing);
-- 
cgit v1.2.1