[mutter] MonitorManager: make sure to pass the right sizes to vararg functions



commit 46f4ea7ed7daf89f8aa2ea08d90ce36410355c9a
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Mon Sep 2 09:29:26 2013 +0200

    MonitorManager: make sure to pass the right sizes to vararg functions
    
    A gulong is not enough to get 64 bits in all arches, so we must
    cast it, or we can corrupt the stack.
    
    This was downstream bug bugzilla.redhat.com/show_bug.cgi?id=1002055
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707267

 src/core/monitor.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/core/monitor.c b/src/core/monitor.c
index c6b4649..6aea003 100644
--- a/src/core/monitor.c
+++ b/src/core/monitor.c
@@ -764,13 +764,13 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
 
       g_variant_builder_add (&crtc_builder, "(uxiiiiiuaua{sv})",
                              i, /* ID */
-                             crtc->crtc_id,
+                             (gint64)crtc->crtc_id,
                              (int)crtc->rect.x,
                              (int)crtc->rect.y,
                              (int)crtc->rect.width,
                              (int)crtc->rect.height,
                              (int)(crtc->current_mode ? crtc->current_mode - manager->modes : -1),
-                             crtc->transform,
+                             (guint32)crtc->transform,
                              &transforms,
                              NULL /* properties */);
     }
@@ -838,7 +838,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
 
       g_variant_builder_add (&output_builder, "(uxiausauaua{sv})",
                              i, /* ID */
-                             output->output_id,
+                             (gint64)output->output_id,
                              (int)(output->crtc ? output->crtc - manager->crtcs : -1),
                              &crtcs,
                              output->name,
@@ -853,9 +853,9 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
 
       g_variant_builder_add (&mode_builder, "(uxuud)",
                              i, /* ID */
-                             mode->mode_id,
-                             mode->width,
-                             mode->height,
+                             (gint64)mode->mode_id,
+                             (guint32)mode->width,
+                             (guint32)mode->height,
                              (double)mode->refresh_rate);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]