[eog/gnome-2-26] Bug 579212 - JPEG file causes memory corruption



commit c5cd0ece9c1251756c512bac3585e210b05f4de8
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 a6b6afc..5cc1c4f 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-13  Felix Riemann  <friemann svn gnome org>
 
 	* configure.ac: Post release version bump.
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]