From 13aa12ea1412bd33363ed3a10e2dab691fd0d660 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Sat, 17 Jul 1999 22:42:49 +0000 Subject: [PATCH] ensure that the allocated width and height is never zero. sanity check Sun Jul 18 00:35:49 1999 Tim Janik * gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated width and height is never zero. sanity check both dimensions against 32767 and issue a warning if the allocation is greater than that. --- ChangeLog | 6 ++++++ ChangeLog.pre-2-0 | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-2 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtkwidget.c | 13 +++++++++++++ 8 files changed, 55 insertions(+) diff --git a/ChangeLog b/ChangeLog index 09e2f327c2..cabe51cd56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Jul 18 00:35:49 1999 Tim Janik + + * gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated + width and height is never zero. sanity check both dimensions against + 32767 and issue a warning if the allocation is greater than that. + Fri Jul 16 22:20:21 PDT 1999 Manish Singh * ltconfig diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 09e2f327c2..cabe51cd56 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,9 @@ +Sun Jul 18 00:35:49 1999 Tim Janik + + * gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated + width and height is never zero. sanity check both dimensions against + 32767 and issue a warning if the allocation is greater than that. + Fri Jul 16 22:20:21 PDT 1999 Manish Singh * ltconfig diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 09e2f327c2..cabe51cd56 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Sun Jul 18 00:35:49 1999 Tim Janik + + * gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated + width and height is never zero. sanity check both dimensions against + 32767 and issue a warning if the allocation is greater than that. + Fri Jul 16 22:20:21 PDT 1999 Manish Singh * ltconfig diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 09e2f327c2..cabe51cd56 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,9 @@ +Sun Jul 18 00:35:49 1999 Tim Janik + + * gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated + width and height is never zero. sanity check both dimensions against + 32767 and issue a warning if the allocation is greater than that. + Fri Jul 16 22:20:21 PDT 1999 Manish Singh * ltconfig diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 09e2f327c2..cabe51cd56 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Sun Jul 18 00:35:49 1999 Tim Janik + + * gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated + width and height is never zero. sanity check both dimensions against + 32767 and issue a warning if the allocation is greater than that. + Fri Jul 16 22:20:21 PDT 1999 Manish Singh * ltconfig diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 09e2f327c2..cabe51cd56 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Sun Jul 18 00:35:49 1999 Tim Janik + + * gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated + width and height is never zero. sanity check both dimensions against + 32767 and issue a warning if the allocation is greater than that. + Fri Jul 16 22:20:21 PDT 1999 Manish Singh * ltconfig diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 09e2f327c2..cabe51cd56 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Sun Jul 18 00:35:49 1999 Tim Janik + + * gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated + width and height is never zero. sanity check both dimensions against + 32767 and issue a warning if the allocation is greater than that. + Fri Jul 16 22:20:21 PDT 1999 Manish Singh * ltconfig diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 3b553997c7..5698bf128d 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -2436,6 +2436,19 @@ gtk_widget_size_allocate (GtkWidget *widget, if (aux_info->y != -1) real_allocation.y = aux_info->y; } + + real_allocation.width = MAX (real_allocation.width, 1); + real_allocation.height = MAX (real_allocation.height, 1); + + if (real_allocation.width > 32767 || + real_allocation.height > 32767) + { + g_warning ("gtk_widget_size_allocate(): attempt to allocate widget with width %d and height %d", + real_allocation.width, + real_allocation.height); + real_allocation.width = MIN (real_allocation.width, 32767); + real_allocation.height = MIN (real_allocation.height, 32767); + } if (GTK_WIDGET_NO_WINDOW (widget)) {