[gnome-builder] egg-task-cache: fix invalid dereference during cache heap sort



commit 344f2645fd7bf7249cf6fc6044cceaafcccf2209
Author: Christian Hergert <chergert redhat com>
Date:   Thu Sep 1 22:15:44 2016 -0700

    egg-task-cache: fix invalid dereference during cache heap sort
    
    The heap will give us a pointer to our structure type, which is also a
    pointer. So we need to dereference to access our pointer to CacheItem.

 contrib/egg/egg-task-cache.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/contrib/egg/egg-task-cache.c b/contrib/egg/egg-task-cache.c
index 0f0e68f..c932a53 100644
--- a/contrib/egg/egg-task-cache.c
+++ b/contrib/egg/egg-task-cache.c
@@ -181,8 +181,8 @@ static gint
 cache_item_compare_evict_at (gconstpointer a,
                              gconstpointer b)
 {
-  const CacheItem *ci1 = a;
-  const CacheItem *ci2 = b;
+  const CacheItem **ci1 = (const CacheItem **)a;
+  const CacheItem **ci2 = (const CacheItem **)b;
   gint64 ret;
 
   /*
@@ -191,7 +191,7 @@ cache_item_compare_evict_at (gconstpointer a,
    * ensure we are within the 32-bit boundary.
    */
 
-  ret = ci2->evict_at - ci1->evict_at;
+  ret = (*ci2)->evict_at - (*ci1)->evict_at;
 
   if (ret < 0)
     return -1;


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