GNOME Bugzilla – Bug 342288
Hangs when importing a GIF file named as xxx.JPG
Last modified: 2010-07-08 18:04:54 UTC
Please describe the problem: When I'm trying to import a directory that contains the tiger_sitting.jpg file: http://eskimo.shlomifish.org/bugs/f-spot/tiger_standing.jpg F-Spot hangs. Steps to reproduce: Actual results: F-Spot hangs. Expected results: The image should be imported. Does this happen every time? Yes. Other information: I added a few print statements to the code, and am getting the following output: <<< open uri = file:///home/shlomi/TEMP/F-Spot-Crash/tiger_standing.jpg foo TRam Proskote 1 Proskote 2 Proskote 3 Kudadronfu 1 Kudadronfu 1.2 Kudadronfu 1.5 Kudadronfu 2 Kudadronfu 4 Kudadronfu 5 Kudadronfu 6 Kudadronfu 6.1 17974 >>> Now, the modified code is this: (from JpegHeader.cs) <<<<<<<<<<< public static Marker Load (Stream stream) { System.Console.WriteLine("Kudadronfu 1"); byte [] raw = new byte [2]; ushort length; if (stream.Length - stream.Position < 2) return null; System.Console.WriteLine("Kudadronfu 1.2"); // FIXME there is a potential loop here. int read = Read (stream, raw, 0, 2); System.Console.WriteLine("Kudadronfu 1.5"); if (read < 2 && raw [0] != 0xff) throw new System.Exception (System.String.Format ("Invalid marker found {0}", raw [0])); System.Console.WriteLine("Kudadronfu 2"); JpegMarker id = (JpegMarker) raw [1]; switch (id) { case JpegMarker.Soi: case JpegMarker.Eoi: case JpegMarker.Rst0: case JpegMarker.Rst1: case JpegMarker.Rst2: case JpegMarker.Rst3: case JpegMarker.Rst4: case JpegMarker.Rst5: case JpegMarker.Rst6: case JpegMarker.Rst7: case JpegMarker.Tem: case (JpegMarker) 0: System.Console.WriteLine("Kudadronfu 3"); return new Marker (id, null); default: System.Console.WriteLine("Kudadronfu 4"); Read (stream, raw, 0, 2); System.Console.WriteLine("Kudadronfu 5"); length = FSpot.BitConverter.ToUInt16 (raw, 0, false); System.Console.WriteLine("Kudadronfu 6"); byte [] data = new byte [length - 2]; System.Console.WriteLine("Kudadronfu 6.1 {0}", data.Length); Read (stream, data, 0, data.Length); System.Console.WriteLine("Kudadronfu 7"); Marker ret = new Marker (id, data); System.Console.WriteLine("Kudadronfu 8"); return ret; } } >>>>>>>>>>> data.Length is reported to be 17974, but the file size is 13,286.
I open this file in IrfanView, and it directly complains it is a GIF file, not a JPEG file. Is this correct or?
(In reply to comment #1) > I open this file in IrfanView, and it directly complains it is a GIF file, not > a JPEG file. > > Is this correct or? > Yes, it is indeed a GIF file (at least according to the file command and xli). So this is probably the source of the problem I'm experiencing. In any case F-Spot should not hang when trying to read a GIF file that ends with .jpg.
I renamed the file to tiger_standing.gif, and F-Spot happily imports it. When the filename is tiger_standing.jpg, F-Spot hangs. Changing title to reflect this.
will be fixed with bug #326411
*** Bug 346868 has been marked as a duplicate of this bug. ***
(In reply to comment #4) > will be fixed with bug #326411 I'd mark as dup of that!
It won't be fixed by bug #326411, as the mime types are only used as a fallback. The real question is: why do you want GIF files with a JPG extension?
Can be fixed by using the content-type first. If we're querying it anyway, we might as well just use it.
Resolved by bug 622147.