eog r4412 - in trunk: . src
- From: friemann svn gnome org
- To: svn-commits-list gnome org
- Subject: eog r4412 - in trunk: . src
- Date: Fri, 29 Feb 2008 22:06:45 +0000 (GMT)
Author: friemann
Date: Fri Feb 29 22:06:45 2008
New Revision: 4412
URL: http://svn.gnome.org/viewvc/eog?rev=4412&view=rev
Log:
2008-02-29 Felix Riemann <friemann svn gnome org>
* src/eog-metadata-reader.c: (eog_metadata_reader_consume):
Only extract a possible ICC block from a JPEG file if is actually
large enough. Check the chunk name afterwards if it really is an ICC
chunk. Also check if it is the first and only ICC chunk in the file to
fix a (possibly fatal) warning from lcms as we don't support merging
JFIF chunks yet. Fixes bug #519028.
Modified:
trunk/ChangeLog
trunk/src/eog-metadata-reader.c
Modified: trunk/src/eog-metadata-reader.c
==============================================================================
--- trunk/src/eog-metadata-reader.c (original)
+++ trunk/src/eog-metadata-reader.c Fri Feb 29 22:06:45 2008
@@ -243,8 +243,9 @@
{
priv->state = EMR_READ_APP1;
} else if (priv->last_marker == EOG_JPEG_MARKER_APP2 &&
- priv->icc_chunk == NULL)
+ priv->icc_chunk == NULL && priv->size > 14)
{
+ /* Chunk has 14 bytes identification data */
priv->state = EMR_READ_ICC;
} else if (priv->last_marker == EOG_JPEG_MARKER_APP14 &&
priv->iptc_chunk == NULL)
@@ -346,9 +347,36 @@
priv->bytes_read = 0;
}
- eog_metadata_reader_get_next_block (priv, priv->icc_chunk,
- &i, buf, len, EMR_READ_ICC);
-
+ eog_metadata_reader_get_next_block (priv,
+ priv->icc_chunk,
+ &i, buf, len,
+ EMR_READ_ICC);
+
+ /* Test that the chunk actually contains ICC data. */
+ if (priv->state == EMR_READ && priv->icc_chunk) {
+ const char* icc_chunk = priv->icc_chunk;
+ gboolean valid = TRUE;
+
+ /* Chunk should begin with the
+ * ICC_PROFILE\0 identifier */
+ valid &= strncmp (icc_chunk,
+ "ICC_PROFILE\0",12) == 0;
+ /* Make sure this is the first and only
+ * ICC chunk in the file as we don't
+ * support merging chunks yet. */
+ valid &= *(guint16*)(icc_chunk+12) == 0x101;
+
+ if (!valid) {
+ /* This no ICC data. Throw it away. */
+ eog_debug_message (DEBUG_IMAGE_DATA,
+ "Supposed ICC chunk didn't validate. "
+ "Ignoring.");
+ g_free (priv->icc_chunk);
+ priv->icc_chunk = NULL;
+ priv->icc_len = 0;
+ }
+ }
+
if (IS_FINISHED(priv))
priv->state = EMR_FINISHED;
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]