GNOME Bugzilla – Bug 636694
F-Spot crashes on loading metadata of JPG
Last modified: 2010-12-19 12:19:49 UTC
This jpg is already in my library. When clicking it, F-Spot crashes with: [1 Debug 12:54:00.019] Loading of metadata failed for file: file:///home/paul/Photos/2009/02/04/DSC_4984.bibble.jpg, trying extension fallback [1 Debug 12:54:00.020] Loading of metadata failed for file: file:///home/paul/Photos/2009/02/04/DSC_4984.bibble.jpg [1 Warn 12:54:00.027] Caught an exception - System.Xml.XmlException: Document element did not appear. Line 1, position 1. (in `System.Xml') at Mono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0 at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.ReadNode (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.Load (System.Xml.XmlReader xmlReader) [0x00000] in <filename unknown>:0 at System.Xml.XmlDocument.LoadXml (System.String xml) [0x00000] in <filename unknown>:0 at TagLib.Xmp.XmpTag..ctor (System.String data, TagLib.File file) [0x00011] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/Xmp/XmpTag.cs:259 at TagLib.Jpeg.File.ReadAPP1Segment (UInt16 length) [0x00176] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/Jpeg/File.cs:486 at TagLib.Jpeg.File.ReadMetadata () [0x000b6] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/Jpeg/File.cs:374 at TagLib.Jpeg.File.Read (ReadStyle propertiesStyle) [0x0001d] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/Jpeg/File.cs:246 at TagLib.Jpeg.File..ctor (IFileAbstraction abstraction, ReadStyle propertiesStyle) [0x00007] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/Jpeg/File.cs:167 at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (object,object[],System.Exception&) at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 Exception in Gtk# callback delegate Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception. System.NullReferenceException: Object reference not set to an instance of an object at FSpot.Widgets.InfoBox.<SetupWidgets>m__4D (IPhoto photo, TagLib.Image.File metadata) [0x00000] in /usr/src/f-spot/src/Clients/MainApp/FSpot.Widgets/InfoBox.cs:392 at FSpot.Widgets.InfoBox+<AddLabelEntry>c__AnonStoreyE.<>m__43 (Gtk.Widget widget, IPhoto photo, TagLib.Image.File metadata) [0x00000] in /usr/src/f-spot/src/Clients/MainApp/FSpot.Widgets/InfoBox.cs:122 at FSpot.Widgets.InfoBox.Update () [0x0008c] in /usr/src/f-spot/src/Clients/MainApp/FSpot.Widgets/InfoBox.cs:509 at FSpot.Utils.DelayedOperation.HandleOperation () [0x0000d] in /usr/src/f-spot/src/Core/FSpot.Utils/FSpot.Utils/DelayedOperation.cs:57 at GLib.Idle+IdleProxy.Handler () [0x00000] in <filename unknown>:0 at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal) at GLib.Idle+IdleProxy.Handler() at Gtk.Application.gtk_main() at Gtk.Application.Run() at FSpot.Driver.Startup() in /usr/src/f-spot/src/Clients/MainApp/FSpot/main.cs:line 390 at Hyena.Gui.CleanRoomStartup.Startup(Hyena.Gui.StartupInvocationHandler startup) in /usr/src/f-spot/lib/Hyena/Hyena.Gui/Hyena.Gui/CleanRoomStartup.cs:line 54 at FSpot.Driver.Main(System.String[] args) in /usr/src/f-spot/src/Clients/MainApp/FSpot/main.cs:line 308
That's the XMP (there seem to be a BOM or whatever character at start?): ^@<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:tiff="http://ns.adobe.com/tiff/1.0/" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:exif="http://ns.adobe.com/exif/1.0/" tiff:Model="NIKON D70" tiff:Make="NIKON CORPORATION" tiff:FNumber="40/10" xmp:ModifyDate="2009:02:04 08:10:23" xmp:CreatorTool="Ver.2.00 " xmp:Label="" xmp:Rating="0" exif:DateTimeOriginal="2009:02:04 08:10:23" exif:DateTimeDigitized="2009:02:04 08:10:23" exif:ExposureProgram="2" exif:MeteringMode="5" exif:LightSource="0" exif:ExposureMode="0" exif:WhiteBalance="0" exif:FocalLengthIn35mmFilm="30" exif:SceneCaptureType="0" exif:Contrast="1" exif:Saturation="0" exif:Sharpness="0" exif:SubjectDistanceRange="0" exif:ISOSpeedRating="220" exif:Flash="31" exif:MaxApertureValue="38/10" exif:ExposureTime="10/300" exif:ExposureBiasValue="0/6" exif:FocalLength="200/10"/> </rdf:RDF> </x:xmpmeta>
Created attachment 176005 [details] Test case (Nikon JPG, Size reduced)
exiv2 isn't able to decode the XMP data neither: $ exiv2 ex DSC_4984.bibble_small.jpg XMP Toolkit error 201: XML parsing failure Warning: Failed to decode XMP metadata. Nevertheless, F-Spot shouldn't crash on such files!
The problem seems to be that there are two NULL bytes before the root tag of the XMP XML: Hex: 2F 00 00 3C Is: / \0 \0 < Where 2F is the ending of http://ns.adobe.com/xap/1.0/ and < is the start of <x:xmpmeta...> Should this be treated as corrupt (=> F-Spot will catch the exception and refuse reading/writing this XMP) or should taglib be able to work around this?
The Exception while importing this image is caught by F-Spot. An error message appears and the file is not imported. So we would need two fixes here: - Catch the exception while clicking on this image if it is already in the database - Allow importing of this image, but ignore corrupt metadata
Created attachment 176351 [details] [review] Don't crash if UI does not know the image metadata, happens on corrupt xmp, for example.
*** Bug 637007 has been marked as a duplicate of this bug. ***
Created attachment 176493 [details] Infobox if metadata is null The infobox will look like the screenshot attached, if the metadata returned is null (for whatever reason). The "(Unknown)" string was invented before already, so I used it here as well. An alternative would be to hide the infobox entirely.
Should be fixed thanks to https://bugzilla.gnome.org/show_bug.cgi?id=637283