gthumb (3:2.11.5-4) 14-safe_exif_read.patch

Summary

 extensions/exiv2_tools/exiv2-utils.cpp |   11 +++++++++--
 po/POTFILES.skip                       |    2 ++
 2 files changed, 11 insertions(+), 2 deletions(-)

    
download this patch

Patch contents

From: David Paleino <dapal@debian.org>
Subject: read Exif orientation in a safer way, since it seems like some
 cameras don't store it
Bug-Debian: http://bugs.debian.org/601137
Origin: vendor
Forwarded: no

---
 extensions/exiv2_tools/exiv2-utils.cpp |   11 +++++++++--
 po/POTFILES.skip                       |    2 ++
 2 files changed, 11 insertions(+), 2 deletions(-)

--- gthumb.orig/extensions/exiv2_tools/exiv2-utils.cpp
+++ gthumb/extensions/exiv2_tools/exiv2-utils.cpp
@@ -918,7 +918,11 @@ exiv2_generate_thumbnail (const char *ur
 			if (thumb.pData_ != NULL) {
 				Exiv2::ExifData &ed = image->exifData();
 
-				long orientation = ed["Exif.Image.Orientation"].toLong();
+				// We'll just use "1", hoping everything goes well
+				long orientation = 1L;
+				if (ed["Exif.Image.Orientation"].count() > 0)
+					long orientation = ed["Exif.Image.Orientation"].toLong();
+
 				long image_width = ed["Exif.Photo.PixelXDimension"].toLong();
 				long image_height = ed["Exif.Photo.PixelYDimension"].toLong();
 
@@ -953,7 +957,10 @@ exiv2_generate_thumbnail (const char *ur
 							/* Set the orientation option to correctly rotate the thumbnail
 							 * in gnome_desktop_thumbnail_factory_generate_thumbnail() */
 
-							long  orientation = ed["Exif.Image.Orientation"].toLong();
+							// We'll just use "1", hoping everything goes well
+							long orientation = 1L;
+							if (ed["Exif.Image.Orientation"].count() > 0)
+								long orientation = ed["Exif.Image.Orientation"].toLong();
 							char *orientation_s = g_strdup_printf ("%ld", orientation);
 							gdk_pixbuf_set_option (pixbuf, "orientation", orientation_s);
 							g_free (orientation_s);
--- gthumb.orig/po/POTFILES.skip
+++ gthumb/po/POTFILES.skip
@@ -18,3 +18,5 @@ extensions/webalbums/albumtheme.c
 #.pc/16-fix_crop_dialog_usability.patch/src/dlg-crop.c
 #.pc/17-dont_follow_symlinks_on_dups_search.patch/src/dlg-duplicates.c
 .pc/18-build_with_gtk2.19.patch/gthumb/gth-tags-entry.c
+
+.pc/14-safe_exif_read.patch/extensions/exiv2_tools/exiv2-utils.cpp