[gtk+/gtk-3-2] iconcache: Always check return value of find_image_offset.



commit b076de940911b7c0aa05b8e56e5506dad2bf6253
Author: Will Newton <will newton imgtec com>
Date:   Thu Jan 12 11:14:02 2012 +0000

    iconcache: Always check return value of find_image_offset.
    
    find_image_offset returns 0 if it failed to find a matching image.
    Check this return value in _gtk_icon_cache_get_icon to avoid
    making bad memory accesses later.
    
    Signed-off-by: Will Newton <will newton imgtec com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=667745

 gtk/gtkiconcache.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkiconcache.c b/gtk/gtkiconcache.c
index 53ceccb..486b176 100644
--- a/gtk/gtkiconcache.c
+++ b/gtk/gtkiconcache.c
@@ -448,6 +448,9 @@ _gtk_icon_cache_get_icon (GtkIconCache *cache,
 
   offset = find_image_offset (cache, icon_name, directory_index);
   
+  if (!offset)
+    return NULL;
+
   image_data_offset = GET_UINT32 (cache->buffer, offset + 4);
   
   if (!image_data_offset)



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