LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File libexif-current.patch of Package libexif (Project DISCONTINUED:openSUSE:10.3:Update)

diff -x '*.m4' -x '*.o' -x '*.lo' -ru libexif-0.6.16/ChangeLog /suse/meissner/projects/libexif/ChangeLog
--- libexif-0.6.16/ChangeLog	2007-05-23 16:06:35.000000000 +0200
+++ /suse/meissner/projects/libexif/ChangeLog	2007-08-20 11:02:55.903507000 +0200
@@ -1,3 +1,14 @@
+2007-08-16  Jan Patera <patera@users.sourceforge.net>
+
+	* exif-mnote-data-olympus.c: Fix of bugs #1773810, #1774626, gnome bug #466044:
+	  Some Olympus files have main IFD in MM byte order as well as makernote, but
+	  makernote order was guessed wrongly. Bug introduced when fixing bug #1525770.
+
+2007-06-25  Jan Patera <patera@users.sourceforge.net>
+
+	* Endianess of Nikon V1 makernotes is now guessed, it might not
+	  be the same as of the main IFD
+
 2007-05-21  Jan Patera <patera@users.sourceforge.net>
 
 	* First version of Czech localization (cs.po)
diff -x '*.m4' -x '*.o' -x '*.lo' -ru libexif-0.6.16/libexif/exif-data.c /suse/meissner/projects/libexif/libexif/exif-data.c
--- libexif-0.6.16/libexif/exif-data.c	2007-06-12 17:52:25.000000000 +0200
+++ /suse/meissner/projects/libexif/libexif/exif-data.c	2007-07-05 19:02:47.068150000 +0200
@@ -194,6 +195,9 @@
 	if (entry->data) {
 		entry->size = s;
 		memcpy (entry->data, d + doff, s);
+	} else {
+		/* FIXME: What do our callers do if (entry->data == NULL)? */
+		EXIF_LOG_NO_MEMORY(data->priv->log, "ExifData", s);
 	}
 
 	/* If this is the MakerNote, remember the offset */
@@ -202,8 +206,7 @@
 			exif_log (data->priv->log,
                                                EXIF_LOG_CODE_DEBUG, "ExifData",
                                                "MakerNote found with NULL data");	
-		}
-		else if (entry->size > 6) 
+		} else if (entry->size > 6) {
 			exif_log (data->priv->log,
 					       EXIF_LOG_CODE_DEBUG, "ExifData",
 					       "MakerNote found (%02x %02x %02x %02x "
@@ -211,6 +214,7 @@
 					       entry->data[0], entry->data[1], entry->data[2],
 					       entry->data[3], entry->data[4], entry->data[5],
 					       entry->data[6]);
+		}
 		data->priv->offset_mnote = doff;
 	}
 	return 1;
@@ -334,8 +338,10 @@
 
 	if (!data || !data->priv) 
 		return;
-	if ((ifd < 0) || (ifd >= EXIF_IFD_COUNT)) 
-		return;
+
+	/* check for valid ExifIfd enum range */
+	if (( ((int)ifd) < 0) || ( ((int)ifd) >= EXIF_IFD_COUNT))
+	  return;
 
 	if (recursion_depth > 150) {
 		exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, "ExifData",
diff -x '*.m4' -x '*.o' -x '*.lo' -ru libexif-0.6.16/libexif/exif-entry.c /suse/meissner/projects/libexif/libexif/exif-entry.c
--- libexif-0.6.16/libexif/exif-entry.c	2007-05-23 16:06:37.000000000 +0200
+++ /suse/meissner/projects/libexif/libexif/exif-entry.c	2007-07-05 19:02:47.150071000 +0200
@@ -581,9 +581,10 @@
 		return val;
 	o = exif_data_get_byte_order (e->parent->parent);
 
+	/* make sure the returned string is zero terminated */
 	memset (val, 0, maxlen);
-	memset (b, 0, sizeof (b));
 	maxlen--;
+	memset (b, 0, sizeof (b));
 
 	/* Sanity check */
 	if (e->size != e->components * exif_format_get_size (e->format)) {
@@ -863,7 +864,7 @@
 	case EXIF_TAG_MAKER_NOTE:
 		CF (e, EXIF_FORMAT_UNDEFINED, val, maxlen);
 		snprintf (val, maxlen, _("%i bytes unknown data"),
-			  (int) e->components);
+			  e->size);
 		break;
 	case EXIF_TAG_SUBJECT_AREA:
 		CF (e, EXIF_FORMAT_SHORT, val, maxlen);
@@ -914,7 +915,7 @@
 		/* Search the tag */
 		for (i = 0; list2[i].tag && (list2[i].tag != e->tag); i++);
 		if (!list2[i].tag) {
-			strncpy (val, _("Internal error."), maxlen - 1);
+			strncpy (val, _("Internal error"), maxlen);
 			break;
 		}
 
@@ -923,7 +924,7 @@
 			    (list2[i].elem[j].index < v_short); j++);
 		if (list2[i].elem[j].index != v_short) {
 			snprintf (val, maxlen, _("Internal error (unknown "
-				  "value %i)."), v_short);
+				  "value %i)"), v_short);
 			break;
 		}
 
@@ -932,7 +933,7 @@
 		for (k = 0; list2[i].elem[j].values[k]; k++) {
 		  l = strlen (_(list2[i].elem[j].values[k]));
 		  if ((maxlen > l) && (strlen (val) < l))
-		    strncpy (val, _(list2[i].elem[j].values[k]), maxlen - 1);
+		    strncpy (val, _(list2[i].elem[j].values[k]), maxlen);
 		}
 		if (!strlen (val)) snprintf (val, maxlen, "%i", v_short);
 
@@ -957,7 +958,7 @@
 		/* Search the tag */
 		for (i = 0; list[i].tag && (list[i].tag != e->tag); i++);
 		if (!list[i].tag) {
-			strncpy (val, _("Internal error."), maxlen - 1);
+			strncpy (val, _("Internal error"), maxlen);
 			break;
 		}
 
@@ -966,7 +967,7 @@
 		if (!list[i].strings[j])
 			snprintf (val, maxlen, "%i", v_short);
 		else
-			strncpy (val, _(list[i].strings[j]), maxlen - 1);
+			strncpy (val, _(list[i].strings[j]), maxlen);
 		break;
 	case EXIF_TAG_XP_TITLE:
 	case EXIF_TAG_XP_COMMENT:
@@ -1098,6 +1099,10 @@
 	return val;
 }
 
+
+/**
+ * \bug Log and report failed exif_mem_malloc() calls.
+ */
 void
 exif_entry_initialize (ExifEntry *e, ExifTag tag)
 {
@@ -1126,6 +1131,7 @@
 		e->format = EXIF_FORMAT_LONG;
 		e->size = exif_format_get_size (e->format) * e->components;
 		e->data = exif_entry_alloc (e, e->size);
+		if (!e->data) break;
 		break;
 
 	/* SHORT, 1 component, no default */
@@ -1154,6 +1160,7 @@
 		e->format = EXIF_FORMAT_SHORT;
 		e->size = exif_format_get_size (e->format) * e->components;
 		e->data = exif_entry_alloc (e, e->size);
+		if (!e->data) break;
 		exif_set_short (e->data, o, 0);
 		break;
 
@@ -1165,6 +1172,7 @@
 		e->format = EXIF_FORMAT_SHORT;
 		e->size = exif_format_get_size (e->format) * e->components;
 		e->data = exif_entry_alloc (e, e->size);
+		if (!e->data) break;
 		exif_set_short (e->data, o, 1);
 		break;
 
@@ -1175,6 +1183,7 @@
 		e->format = EXIF_FORMAT_SHORT;
 		e->size = exif_format_get_size (e->format) * e->components;
 		e->data = exif_entry_alloc (e, e->size);
+		if (!e->data) break;
 		exif_set_short (e->data, o, 2);
 		break;
 
@@ -1184,6 +1193,7 @@
 		e->format = EXIF_FORMAT_SHORT;
 		e->size = exif_format_get_size (e->format) * e->components;
 		e->data = exif_entry_alloc (e, e->size);
+		if (!e->data) break;
 		exif_set_short (e->data, o, 3);
 		break;
 
@@ -1221,6 +1231,7 @@
 		e->format = EXIF_FORMAT_SRATIONAL;
 		e->size = exif_format_get_size (e->format) * e->components;
 		e->data = exif_entry_alloc (e, e->size);
+		if (!e->data) break;
 		break;
 
 	/* RATIONAL, 1 component, no default */
@@ -1241,6 +1252,7 @@
 		e->format = EXIF_FORMAT_RATIONAL;
 		e->size = exif_format_get_size (e->format) * e->components;
 		e->data = exif_entry_alloc (e, e->size);
+		if (!e->data) break;
 		break;
 
 	/* RATIONAL, 1 component, default 72/1 */
@@ -1250,6 +1262,7 @@
 		e->format = EXIF_FORMAT_RATIONAL;
 		e->size = exif_format_get_size (e->format) * e->components;
 		e->data = exif_entry_alloc (e, e->size);
+		if (!e->data) break;
 		r.numerator = 72;
 		r.denominator = 1;
 		exif_set_rational (e->data, o, r);
@@ -1261,6 +1274,7 @@
 		e->format = EXIF_FORMAT_RATIONAL;
 		e->size = exif_format_get_size (e->format) * e->components;
 		e->data = exif_entry_alloc (e, e->size);
+		if (!e->data) break;
 		break;
 
 	/* RATIONAL, 6 components */
diff -x '*.m4' -x '*.o' -x '*.lo' -ru libexif-0.6.16/libexif/exif-loader.c /suse/meissner/projects/libexif/libexif/exif-loader.c
--- libexif-0.6.16/libexif/exif-loader.c	2006-10-16 13:03:31.000000000 +0200
+++ /suse/meissner/projects/libexif/libexif/exif-loader.c	2007-07-05 19:02:47.204013000 +0200
@@ -263,7 +263,7 @@
 		default:
 			switch (eld->b[i]) {
 			case JPEG_MARKER_APP1:
-				if (!memcmp (eld->b + i + 3, ExifHeader, MIN(sizeof (ExifHeader), MAX(0, sizeof (eld->b) - i - 3)))) {
+			  if (!memcmp (eld->b + i + 3, ExifHeader, MIN((ssize_t)(sizeof(ExifHeader)), MAX(0, ((ssize_t)(sizeof(eld->b))) - ((ssize_t)i) - 3)))) {
 					eld->data_format = EL_DATA_FORMAT_EXIF;
 				} else {
 					eld->data_format = EL_DATA_FORMAT_JPEG; /* Probably JFIF - keep searching for APP1 EXIF*/
diff -x '*.m4' -x '*.o' -x '*.lo' -ru libexif-0.6.16/libexif/exif-loader.h /suse/meissner/projects/libexif/libexif/exif-loader.h
--- libexif-0.6.16/libexif/exif-loader.h	2006-09-27 10:35:13.000000000 +0200
+++ /suse/meissner/projects/libexif/libexif/exif-loader.h	2007-07-05 19:02:47.243970000 +0200
@@ -24,7 +24,6 @@
 #define __EXIF_LOADER_H__
 
 #include <libexif/exif-data.h>
-#include <libexif/exif-loader.h>
 #include <libexif/exif-log.h>
 #include <libexif/exif-mem.h>
 
diff -x '*.m4' -x '*.o' -x '*.lo' -ru libexif-0.6.16/libexif/olympus/exif-mnote-data-olympus.c /suse/meissner/projects/libexif/libexif/olympus/exif-mnote-data-olympus.c
--- libexif-0.6.16/libexif/olympus/exif-mnote-data-olympus.c	2007-05-11 09:19:13.000000000 +0200
+++ /suse/meissner/projects/libexif/libexif/olympus/exif-mnote-data-olympus.c	2007-08-20 11:02:57.048366000 +0200
@@ -230,6 +230,15 @@
 		else if (buf[o2 + 6 + 1] == 1)
 			n->order = EXIF_BYTE_ORDER_MOTOROLA;
 		o2 += 8;
+		if (o2 >= buf_size) return;
+		c = exif_get_short (buf + o2, n->order);
+		if ((!(c & 0xFF)) && (c > 0x500)) {
+			if (n->order == EXIF_BYTE_ORDER_INTEL) {
+				n->order = EXIF_BYTE_ORDER_MOTOROLA;
+			} else {
+				n->order = EXIF_BYTE_ORDER_INTEL;
+			}
+		}
 
 	} else if (!memcmp (buf + o2, "OLYMPUS", 8)) {
 		/* Olympus S760, S770 */
@@ -267,6 +276,16 @@
 		case nikonV1:
 
 			base = MNOTE_NIKON1_TAG_BASE;
+			/* Fix endianness, if needed */
+			if (o2 >= buf_size) return;
+			c = exif_get_short (buf + o2, n->order);
+			if ((!(c & 0xFF)) && (c > 0x500)) {
+				if (n->order == EXIF_BYTE_ORDER_INTEL) {
+					n->order = EXIF_BYTE_ORDER_MOTOROLA;
+				} else {
+					n->order = EXIF_BYTE_ORDER_INTEL;
+				}
+			}
 			break;
 
 		case nikonV2: