Author: benny
Date: 2007-08-11 09:42:07 +0000 (Sat, 11 Aug 2007)
New Revision: 25967
Modified:
thunar/trunk/ChangeLog
thunar/trunk/thunar-vfs/thunar-vfs-thumb-jpeg.c
Log:
2007-08-11 Benedikt Meurer <[EMAIL PROTECTED]>
* thunar-vfs/thunar-vfs-thumb-jpeg.c: Prevent infinite recursion
on JPEG files with broken exif directories. Bug #3452.
Modified: thunar/trunk/ChangeLog
===================================================================
--- thunar/trunk/ChangeLog 2007-08-11 05:24:15 UTC (rev 25966)
+++ thunar/trunk/ChangeLog 2007-08-11 09:42:07 UTC (rev 25967)
@@ -1,3 +1,8 @@
+2007-08-11 Benedikt Meurer <[EMAIL PROTECTED]>
+
+ * thunar-vfs/thunar-vfs-thumb-jpeg.c: Prevent infinite recursion
+ on JPEG files with broken exif directories. Bug #3452.
+
2007-06-24 Benedikt Meurer <[EMAIL PROTECTED]>
* thunar-vfs/thunar-vfs-path.c: Fix crash on amd64 because of
Modified: thunar/trunk/thunar-vfs/thunar-vfs-thumb-jpeg.c
===================================================================
--- thunar/trunk/thunar-vfs/thunar-vfs-thumb-jpeg.c 2007-08-11 05:24:15 UTC
(rev 25966)
+++ thunar/trunk/thunar-vfs/thunar-vfs-thumb-jpeg.c 2007-08-11 09:42:07 UTC
(rev 25967)
@@ -355,7 +355,8 @@
static void
tvtj_exif_parse_ifd (TvtjExif *exif,
const guchar *ifd_ptr,
- guint ifd_len)
+ guint ifd_len,
+ guint recursion_depth)
{
const guchar *subifd_ptr;
guint subifd_off;
@@ -367,6 +368,10 @@
if (G_UNLIKELY (ifd_len < 2))
return;
+ /* make sure we don't recurse forever with broken files */
+ if (recursion_depth++ > 150)
+ return;
+
/* determine the number of entries */
n = tvtj_exif_get_ushort (exif, ifd_ptr);
@@ -391,7 +396,7 @@
if (G_LIKELY (subifd_off < exif->data_len))
{
/* process the sub IFD recursively */
- tvtj_exif_parse_ifd (exif, subifd_ptr, exif->data_len -
subifd_off);
+ tvtj_exif_parse_ifd (exif, subifd_ptr, exif->data_len -
subifd_off, recursion_depth);
}
}
else if (tag == 0x0103)
@@ -447,7 +452,7 @@
if (subifd_off != 0 && subifd_off < exif->data_len)
{
/* parse next IFD recursively as well */
- tvtj_exif_parse_ifd (exif, exif->data_ptr + subifd_off, exif->data_len -
subifd_off);
+ tvtj_exif_parse_ifd (exif, exif->data_ptr + subifd_off, exif->data_len -
subifd_off, recursion_depth);
}
}
@@ -497,7 +502,7 @@
if (G_LIKELY (offset < length))
{
/* parse the first IFD (recursively parses the remaining...) */
- tvtj_exif_parse_ifd (&exif, data + offset, length - offset);
+ tvtj_exif_parse_ifd (&exif, data + offset, length - offset, 0);
/* check thumbnail compression type */
if (G_LIKELY (exif.thumb_compression == 6)) /* JPEG */
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits