GNOME Bugzilla – Bug 625024
Crash on importing file with invalid (?) metadata
Last modified: 2010-07-22 12:54:37 UTC
[1 Warn 12:50:22.138] Caught an exception - System.Exception: Invalid IFD offset 3948492, length: 63363 (in `TagLib') at TagLib.IFD.IFDReader.ReadIFD (Int64 base_offset, UInt32 offset, UInt32 max_offset) [0x00170] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/IFD/IFDReader.cs:301 at TagLib.IFD.IFDReader.Read (Int32 count) [0x0003b] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/IFD/IFDReader.cs:181 at TagLib.IFD.IFDReader.Read () [0x00000] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/IFD/IFDReader.cs:151 at TagLib.IFD.IFDReader.ParseIFDEntry (UInt16 tag, UInt16 type, UInt32 count, Int64 base_offset, UInt32 offset) [0x00138] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/IFD/IFDReader.cs:926 at TagLib.IFD.IFDReader.CreateIFDEntry (UInt16 tag, UInt16 type, UInt32 count, Int64 base_offset, TagLib.ByteVector offset_data, UInt32 max_offset) [0x00023] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/IFD/IFDReader.cs:345 at TagLib.IFD.IFDReader.ReadIFD (Int64 base_offset, UInt32 offset, UInt32 max_offset) [0x000fa] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/IFD/IFDReader.cs:286 at TagLib.IFD.IFDReader.Read (Int32 count) [0x0003b] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/IFD/IFDReader.cs:181 at TagLib.IFD.IFDReader.Read () [0x00000] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/IFD/IFDReader.cs:151 at TagLib.IFD.IFDReader.ParseIFDEntry (UInt16 tag, UInt16 type, UInt32 count, Int64 base_offset, UInt32 offset) [0x00138] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/IFD/IFDReader.cs:926 at TagLib.IFD.IFDReader.CreateIFDEntry (UInt16 tag, UInt16 type, UInt32 count, Int64 base_offset, TagLib.ByteVector offset_data, UInt32 max_offset) [0x00023] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/IFD/IFDReader.cs:345 at TagLib.IFD.IFDReader.ReadIFD (Int64 base_offset, UInt32 offset, UInt32 max_offset) [0x000fa] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/IFD/IFDReader.cs:286 at TagLib.IFD.IFDReader.Read (Int32 count) [0x0003b] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/IFD/IFDReader.cs:181 at TagLib.IFD.IFDReader.Read () [0x00000] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/IFD/IFDReader.cs:151 at TagLib.Jpeg.File.ReadAPP1Segment (UInt16 length) [0x000d2] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/Jpeg/File.cs:454 at TagLib.Jpeg.File.ReadMetadata () [0x000b6] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/Jpeg/File.cs:367 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] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. (in `mscorlib') at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] at FSpot.Imaging.ImageFile.Create (Hyena.SafeUri uri) [0x0001e] in /usr/src/f-spot/src/Imaging/ImageFile.cs:128 I think we have a general problem here: It is ok, that TagLib throws an Exception, but F-Spot should not crash then. The problem is that F-Spot gets the files by extension (JPG) and the first creation of an Image Object is done while loading the thumbnail (with the delegate in main.cs). There should be something before. If the image is not parsable/readable/has 0 bytes/whatever, it should not be added to the list of files to import.
Created attachment 166372 [details] Testcase
Fixed, thanks for reporting! This corruption is now detected. Files that have it will not be rewritten.