After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 636694 - F-Spot crashes on loading metadata of JPG
F-Spot crashes on loading metadata of JPG
Status: RESOLVED FIXED
Product: f-spot
Classification: Other
Component: Metadata
GIT
Other Linux
: Normal critical
: 0.8.1
Assigned To: F-spot maintainers
F-spot maintainers
: 637007 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-12-07 12:26 UTC by Paul Wellner Bou
Modified: 2010-12-19 12:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test case (Nikon JPG, Size reduced) (5.80 KB, image/jpeg)
2010-12-07 13:10 UTC, Paul Wellner Bou
  Details
Don't crash if UI does not know the image metadata, happens on corrupt xmp, for example. (1.27 KB, patch)
2010-12-13 17:26 UTC, Paul Wellner Bou
none Details | Review
Infobox if metadata is null (22.45 KB, image/png)
2010-12-15 19:47 UTC, Paul Wellner Bou
  Details

Description Paul Wellner Bou 2010-12-07 12:26:34 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
Comment 1 Paul Wellner Bou 2010-12-07 13:04:53 UTC
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>
Comment 2 Paul Wellner Bou 2010-12-07 13:10:09 UTC
Created attachment 176005 [details]
Test case (Nikon JPG, Size reduced)
Comment 3 Paul Wellner Bou 2010-12-07 13:13:20 UTC
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!
Comment 4 Paul Wellner Bou 2010-12-13 10:36:13 UTC
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?
Comment 5 Paul Wellner Bou 2010-12-13 10:53:53 UTC
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
Comment 6 Paul Wellner Bou 2010-12-13 17:26:17 UTC
Created attachment 176351 [details] [review]
Don't crash if UI does not know the image metadata, happens on corrupt xmp, for example.
Comment 7 Paul Wellner Bou 2010-12-13 17:48:57 UTC
*** Bug 637007 has been marked as a duplicate of this bug. ***
Comment 8 Paul Wellner Bou 2010-12-15 19:47:36 UTC
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.
Comment 9 Ruben Vermeersch 2010-12-19 12:19:49 UTC
Should be fixed thanks to https://bugzilla.gnome.org/show_bug.cgi?id=637283