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 342288 - Hangs when importing a GIF file named as xxx.JPG
Hangs when importing a GIF file named as xxx.JPG
Status: RESOLVED FIXED
Product: f-spot
Classification: Other
Component: General
GIT
Other All
: Normal normal
: 0.7.1
Assigned To: F-spot maintainers
F-spot maintainers
: 346868 (view as bug list)
Depends on: 326411 f-spot-gsoc09 f-spot-taglib
Blocks:
 
 
Reported: 2006-05-18 19:38 UTC by Shlomi Fish
Modified: 2010-07-08 18:04 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Shlomi Fish 2006-05-18 19:38:43 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.
Comment 1 Bengt Thuree 2006-05-19 02:07:29 UTC
I open this file in IrfanView, and it directly complains it is a GIF file, not a JPEG file.

Is this correct or?
Comment 2 Shlomi Fish 2006-05-19 15:26:56 UTC
(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. 
Comment 3 Bengt Thuree 2006-05-19 15:44:08 UTC
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.
Comment 4 Stephane Delcroix 2006-07-07 11:39:03 UTC
will be fixed with bug #326411
Comment 5 Stephane Delcroix 2006-07-07 11:44:06 UTC
*** Bug 346868 has been marked as a duplicate of this bug. ***
Comment 6 Maxxer 2007-11-25 12:27:54 UTC
(In reply to comment #4)
> will be fixed with bug #326411

I'd mark as dup of that!
Comment 7 Ruben Vermeersch 2009-08-11 11:03:51 UTC
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?
Comment 8 Ruben Vermeersch 2010-05-23 15:15:47 UTC
Can be fixed by using the content-type first. If we're querying it anyway, we might as well just use it.
Comment 9 Ruben Vermeersch 2010-07-08 18:04:54 UTC
Resolved by bug 622147.