summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXu Li <xu.li@intel.com>2009-08-03 14:21:44 +0800
committerThomas Thurman <tthurman@gnome.org>2011-01-28 10:24:01 -0500
commit1273850ca7457e05aee020c98ad68ca8246b228e (patch)
tree9a343986a918274331d1667af40ededec4019e1c /src
parent5132ca4145b0f4f4afd5c4ddad6288bc56716140 (diff)
downloadmetacity-1273850ca7457e05aee020c98ad68ca8246b228e.tar.gz
do check of max_size in get_size_limits() to avoid overflow
Diffstat (limited to 'src')
-rw-r--r--src/core/constraints.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/constraints.c b/src/core/constraints.c
index 5606b76b..c28fc0d4 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;
}
}