[gthumb/gthumb-2-12] fixed crash on thumbnail generation



commit cc1ac5ee3a1f27040d310c24f55f6b76514f519c
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Nov 22 11:57:28 2010 +0100

    fixed crash on thumbnail generation
    
    check the number of components of an ExifDatum before converting
    it to a long int.

 extensions/exiv2_tools/exiv2-utils.cpp |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/extensions/exiv2_tools/exiv2-utils.cpp b/extensions/exiv2_tools/exiv2-utils.cpp
index 53e014e..780bf29 100644
--- a/extensions/exiv2_tools/exiv2-utils.cpp
+++ b/extensions/exiv2_tools/exiv2-utils.cpp
@@ -1135,9 +1135,9 @@ exiv2_generate_thumbnail (const char *uri,
 
 		Exiv2::ExifData &ed = image->exifData();
 
-		long orientation = ed["Exif.Image.Orientation"].toLong();
-		long image_width = ed["Exif.Photo.PixelXDimension"].toLong();
-		long image_height = ed["Exif.Photo.PixelYDimension"].toLong();
+		long orientation = (ed["Exif.Image.Orientation"].count() > 0) ? ed["Exif.Image.Orientation"].toLong() : 1;
+		long image_width = (ed["Exif.Photo.PixelXDimension"].count() > 0) ? ed["Exif.Photo.PixelXDimension"].toLong() : -1;
+		long image_height = (ed["Exif.Photo.PixelYDimension"].count() > 0) ? ed["Exif.Photo.PixelYDimension"].toLong() : -1;
 
 		if ((orientation != 1) || (image_width <= 0) || (image_height <= 0))
 			return NULL;



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