[metacity] do check of max_size in get_size_limits() to avoid overflow
- From: Thomas James Alexander Thurman <tthurman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] do check of max_size in get_size_limits() to avoid overflow
- Date: Fri, 28 Jan 2011 15:21:54 +0000 (UTC)
commit 1273850ca7457e05aee020c98ad68ca8246b228e
Author: Xu Li <xu li intel com>
Date: Mon Aug 3 14:21:44 2009 +0800
do check of max_size in get_size_limits() to avoid overflow
src/core/constraints.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/core/constraints.c b/src/core/constraints.c
index 5606b76..c28fc0d 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -710,8 +710,18 @@ get_size_limits (const MetaWindow *window,
min_size->width += fw;
min_size->height += fh;
- max_size->width += fw;
- max_size->height += fh;
+ /* Do check to avoid overflow (e.g. max_size->width & max_size->height
+ * may be set to G_MAXINT by meta_set_normal_hints()).
+ */
+ if (max_size->width < (G_MAXINT - fw))
+ max_size->width += fw;
+ else
+ max_size->width = G_MAXINT;
+
+ if (max_size->height < (G_MAXINT - fh))
+ max_size->height += fh;
+ else
+ max_size->height = G_MAXINT;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]