Author: post
Date: 2010-08-17 18:59:15 +0200 (Tue, 17 Aug 2010)
New Revision: 3492
Modified:
trunk/librawstudio/rs-dcp-file.c
trunk/librawstudio/rs-tiff.c
Log:
Check size of TIFF images before reading them.
Modified: trunk/librawstudio/rs-dcp-file.c
===================================================================
--- trunk/librawstudio/rs-dcp-file.c 2010-08-16 16:20:53 UTC (rev 3491)
+++ trunk/librawstudio/rs-dcp-file.c 2010-08-17 16:59:15 UTC (rev 3492)
@@ -74,7 +74,8 @@
gboolean ret = TRUE;
/* Parse TIFF */
- RS_TIFF_CLASS(rs_dcp_file_parent_class)->read_file_header(tiff);
+ if (!RS_TIFF_CLASS(rs_dcp_file_parent_class)->read_file_header(tiff))
+ return FALSE;
/* Read DCP Magic */
if (rs_tiff_get_ushort(tiff, 2) != 0x4352)
Modified: trunk/librawstudio/rs-tiff.c
===================================================================
--- trunk/librawstudio/rs-tiff.c 2010-08-16 16:20:53 UTC (rev 3491)
+++ trunk/librawstudio/rs-tiff.c 2010-08-17 16:59:15 UTC (rev 3492)
@@ -114,6 +114,9 @@
gboolean ret = TRUE;
guint next_ifd;
+ if (tiff->map_length < 16)
+ return FALSE;
+
/* Read endianness */
if ((tiff->map[0] == 'I') && (tiff->map[1] == 'I'))
tiff->byte_order = G_LITTLE_ENDIAN;
@@ -193,7 +196,8 @@
g_assert(RS_IS_TIFF(tiff));
if (tiff->ifds == 0)
- read_from_file(tiff);
+ if (!read_from_file(tiff))
+ return NULL;
if (ifd_num <= tiff->num_ifd)
ifd = g_list_nth_data(tiff->ifds, ifd_num);
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit