beagle r4700 - in trunk/beagle/Util/F-Spot: Imaging upstream-changes



Author: dbera
Date: Sun Apr 13 20:40:21 2008
New Revision: 4700
URL: http://svn.gnome.org/viewvc/beagle?rev=4700&view=rev

Log:
Import old 04-iptc-crasher-fix.diff


Added:
   trunk/beagle/Util/F-Spot/upstream-changes/04-iptc-crasher-fix.diff
Modified:
   trunk/beagle/Util/F-Spot/Imaging/JpegHeader.cs

Modified: trunk/beagle/Util/F-Spot/Imaging/JpegHeader.cs
==============================================================================
--- trunk/beagle/Util/F-Spot/Imaging/JpegHeader.cs	(original)
+++ trunk/beagle/Util/F-Spot/Imaging/JpegHeader.cs	Sun Apr 13 20:40:21 2008
@@ -383,9 +383,13 @@
 				FSpot.Bim.BimFile bim = new FSpot.Bim.BimFile (bimstream);
 				// FIXME: What about EntryType.XMP ?
 				FSpot.Bim.Entry iptc_entry = bim.FindEntry (FSpot.Bim.EntryType.IPTCNAA);
-				System.IO.Stream iptcstream = new System.IO.MemoryStream (iptc_entry.Data);
-				FSpot.Iptc.IptcFile iptc = new FSpot.Iptc.IptcFile (iptcstream);
-				return iptc;
+				if (iptc_entry == null)
+					return null;
+
+				using (System.IO.Stream iptcstream = new System.IO.MemoryStream (iptc_entry.Data)) {
+					FSpot.Iptc.IptcFile iptc = new FSpot.Iptc.IptcFile (iptcstream);
+					return iptc;
+				}
 			}
 		}
 		return null;

Added: trunk/beagle/Util/F-Spot/upstream-changes/04-iptc-crasher-fix.diff
==============================================================================
--- (empty file)
+++ trunk/beagle/Util/F-Spot/upstream-changes/04-iptc-crasher-fix.diff	Sun Apr 13 20:40:21 2008
@@ -0,0 +1,25 @@
+From: Debajyoti Bera <dbera web gmail com>
+
+Check iptc for null before trying to parse it. Close memory stream.
+
+Index: Imaging/JpegHeader.cs
+===================================================================
+--- Imaging/JpegHeader.cs	(revision 4699)
++++ Imaging/JpegHeader.cs	(working copy)
+@@ -383,9 +383,13 @@
+ 				FSpot.Bim.BimFile bim = new FSpot.Bim.BimFile (bimstream);
+ 				// FIXME: What about EntryType.XMP ?
+ 				FSpot.Bim.Entry iptc_entry = bim.FindEntry (FSpot.Bim.EntryType.IPTCNAA);
+-				System.IO.Stream iptcstream = new System.IO.MemoryStream (iptc_entry.Data);
+-				FSpot.Iptc.IptcFile iptc = new FSpot.Iptc.IptcFile (iptcstream);
+-				return iptc;
++				if (iptc_entry == null)
++					return null;
++
++				using (System.IO.Stream iptcstream = new System.IO.MemoryStream (iptc_entry.Data)) {
++					FSpot.Iptc.IptcFile iptc = new FSpot.Iptc.IptcFile (iptcstream);
++					return iptc;
++				}
+ 			}
+ 		}
+ 		return null;



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