[eog] Bug 579212 - JPEG file causes memory corruption



commit 6e19239933a22ef4e5c785a7d235a7309484c051
Author: Felix Riemann <friemann svn gnome org>
Date:   Fri Apr 17 11:56:14 2009 +0200

    Bug 579212 - JPEG file causes memory corruption
    
    Fixes segfaults and possible memory corruption when loading JPEGs with
    multiple APP1 chunks of the same metadata type (XMP, EXIF). It only
    keeps each first block and ignores the others.
---
 ChangeLog                     |    7 +++++++
 src/eog-metadata-reader-jpg.c |    8 ++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1f670cf..f866ad0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-17  Felix Riemann  <friemann svn gnome org>
+
+	* src/eog-metadata-reader-jpg.c (eog_metadata_reader_jpg_consume):
+	Fix segfaults when loading images with multiple APP1 chunks of the
+	same metadata type (EXIF, XMP). Fixes bug 579212.
+
+
 2009-04-10  Felix Riemann  <friemann svn gnome org>
 
 	* data/eog.schemas.in:
diff --git a/src/eog-metadata-reader-jpg.c b/src/eog-metadata-reader-jpg.c
index 424cb71..6f069da 100644
--- a/src/eog-metadata-reader-jpg.c
+++ b/src/eog-metadata-reader-jpg.c
@@ -327,6 +327,14 @@ eog_metadata_reader_jpg_consume (EogMetadataReaderJpg *emr, const guchar *buf, g
 				break;
 			}
 
+			if (priv->state == EMR_READ_APP1) {
+				/* If a metadata type has already been read
+				 * make sure it's not read again */
+				chunk = NULL;
+				priv->state = EMR_SKIP_BYTES;
+			}
+
+
 			if (chunk) {
 				eog_metadata_reader_get_next_block (priv, chunk,
 								    &i, buf,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]