From 6c244c05497237ee2640d3d4cf7cd3d00baf469f Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 17 Dec 2010 13:53:28 +0000 Subject: [PATCH] geometry: Avoid sign issues when interpolating Width and height in ClutterGeometry are unsigned, and this might lead to overflow and wrap around issues. --- clutter/clutter-actor.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 607b9dcd0..6a256e669 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -9244,12 +9244,16 @@ clutter_geometry_progress (const GValue *a, const ClutterGeometry *a_geom = g_value_get_boxed (a); const ClutterGeometry *b_geom = g_value_get_boxed (b); ClutterGeometry res = { 0, }; + gint a_width = a_geom->width; + gint b_width = b_geom->width; + gint a_height = a_geom->height; + gint b_height = b_geom->height; res.x = a_geom->x + (b_geom->x - a_geom->x) * progress; res.y = a_geom->y + (b_geom->y - a_geom->y) * progress; - res.width = a_geom->width + (b_geom->width - a_geom->width) * progress; - res.height = a_geom->height + (b_geom->height - a_geom->height) * progress; + res.width = a_width + (b_width - a_width) * progress; + res.height = a_height + (b_height - a_height) * progress; g_value_set_boxed (retval, &res);