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
This commit is contained in:
Will Newton 2012-01-12 11:14:02 +00:00 committed by Matthias Clasen
parent dbd66a8f02
commit 96cfd3f8c7

View File

@ -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)