diff options
author | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2011-11-07 12:45:40 +0800 |
---|---|---|
committer | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2011-11-07 12:45:40 +0800 |
commit | af1731d30620e7bd4aaa098af02adc3c71cb30f9 (patch) | |
tree | 48af207e887245bf9fabb0d533b45e31ee7bcb66 /libempathy-gtk/empathy-ui-utils.c | |
parent | 7c0dff773920a0796e079d5c79165a12fc7e8ddd (diff) | |
download | gsoc2013-empathy-af1731d30620e7bd4aaa098af02adc3c71cb30f9.tar gsoc2013-empathy-af1731d30620e7bd4aaa098af02adc3c71cb30f9.tar.gz gsoc2013-empathy-af1731d30620e7bd4aaa098af02adc3c71cb30f9.tar.bz2 gsoc2013-empathy-af1731d30620e7bd4aaa098af02adc3c71cb30f9.tar.lz gsoc2013-empathy-af1731d30620e7bd4aaa098af02adc3c71cb30f9.tar.xz gsoc2013-empathy-af1731d30620e7bd4aaa098af02adc3c71cb30f9.tar.zst gsoc2013-empathy-af1731d30620e7bd4aaa098af02adc3c71cb30f9.zip |
Don't crash when the buffer has length 0
Unexpectedly, a 0 length buffer causes gdk_pixbuf_loader_write() to return
FALSE without setting @error. Would then segv on error->message.
Diffstat (limited to 'libempathy-gtk/empathy-ui-utils.c')
-rw-r--r-- | libempathy-gtk/empathy-ui-utils.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index 30b3e1f28..5d9551d12 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -491,7 +491,10 @@ empathy_pixbuf_from_avatar_scaled (EmpathyAvatar *avatar, G_CALLBACK (pixbuf_from_avatar_size_prepared_cb), &data); - if (!gdk_pixbuf_loader_write (loader, avatar->data, avatar->len, &error)) { + if (avatar->len == 0) { + g_warning ("Avatar has 0 length"); + return NULL; + } else if (!gdk_pixbuf_loader_write (loader, avatar->data, avatar->len, &error)) { g_warning ("Couldn't write avatar image:%p with " "length:%" G_GSIZE_FORMAT " to pixbuf loader: %s", avatar->data, avatar->len, error->message); |