[Xfce4-commits] <tumbler:master> Exit the xdg thumbnailer nicely with corrupt png files.
Nick Schermer
noreply at xfce.org
Sun Dec 4 13:04:01 CET 2011
Updating branch refs/heads/master
to 8d296917e730b1ab805ea07eae41f63bcfe77847 (commit)
from b921277724403f3e404f49871dce86276bde75b6 (commit)
commit 8d296917e730b1ab805ea07eae41f63bcfe77847
Author: Nick Schermer <nick at xfce.org>
Date: Sun Dec 4 12:59:46 2011 +0100
Exit the xdg thumbnailer nicely with corrupt png files.
As described in the libpng manual, set a jump function
for the library to exit when something goes wrong with
reading the png file. This should prevent segfaults
when corrupt or removed png files are read from the cache.
plugins/xdg-cache/xdg-cache-cache.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/plugins/xdg-cache/xdg-cache-cache.c b/plugins/xdg-cache/xdg-cache-cache.c
index e202e40..fb0d59a 100644
--- a/plugins/xdg-cache/xdg-cache-cache.c
+++ b/plugins/xdg-cache/xdg-cache-cache.c
@@ -615,6 +615,19 @@ xdg_cache_cache_read_thumbnail_info (const gchar *filename,
if (info_ptr)
{
+#ifdef PNG_SETJMP_SUPPORTED
+ if (setjmp (png_jmpbuf (png_ptr)))
+ {
+ /* finalize the PNG reader */
+ png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
+
+ /* close the PNG file handle */
+ fclose (png);
+
+ return FALSE;
+ }
+#endif
+
/* initialize reading from the file and read the file info */
png_init_io (png_ptr, png);
png_read_info (png_ptr, info_ptr);
More information about the Xfce4-commits
mailing list