From b076de940911b7c0aa05b8e56e5506dad2bf6253 Mon Sep 17 00:00:00 2001 From: Will Newton Date: Thu, 12 Jan 2012 11:14:02 +0000 Subject: [PATCH] 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 https://bugzilla.gnome.org/show_bug.cgi?id=667745 --- gtk/gtkiconcache.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gtk/gtkiconcache.c b/gtk/gtkiconcache.c index 53ceccb47a..486b176344 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)