[mutter] xprops: Fix reading Window and XSyncCounter properties



commit 54557f062e15e13de2e351eae02ed54f28068102
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Oct 5 17:53:57 2015 +0200

    xprops: Fix reading Window and XSyncCounter properties
    
    Both Window and XSyncCounter are XIDs which on 64 bit X clients are 8
    bytes wide. But the values on the wire are 32 bit so, for these types,
    we always copy 4 bytes into results->prop. As such copying them out
    with a cast such as *(Window *) means that we are actually reading 8
    bytes which depending on whether the higher addressed 4 bytes are zero
    means that sometimes this works while others it gives us a bogus
    value.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756074

 src/x11/xprops.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/x11/xprops.c b/src/x11/xprops.c
index 589d538..be38824 100644
--- a/src/x11/xprops.c
+++ b/src/x11/xprops.c
@@ -507,7 +507,7 @@ window_from_results (GetPropertyResults *results,
   if (!validate_or_free_results (results, 32, XA_WINDOW, TRUE))
     return FALSE;
 
-  *window_p = *(Window*) results->prop;
+  *window_p = *(uint32_t *) results->prop;
   g_free (results->prop);
   results->prop = NULL;
 
@@ -523,7 +523,7 @@ counter_from_results (GetPropertyResults *results,
                                  TRUE))
     return FALSE;
 
-  *counter_p = *(XSyncCounter*) results->prop;
+  *counter_p = *(uint32_t *) results->prop;
   g_free (results->prop);
   results->prop = NULL;
 


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