Bug 324323 - Hang on opening Geolocation pane on photos with XMP GPS tags.
Summary: Hang on opening Geolocation pane on photos with XMP GPS tags.
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Gps (show other bugs)
Version: 3.5.0
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-31 15:37 UTC by Alexander Meshcheryakov
Modified: 2017-08-18 20:52 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.3.0
Sentry Crash Report:


Attachments
Example picture with XMP GPS tags (47.60 KB, image/jpeg)
2013-08-31 15:46 UTC, Alexander Meshcheryakov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Meshcheryakov 2013-08-31 15:37:48 UTC
I have noticed, that several photos have XMP GPS tags. When I import this photos to digiKam album, digiKam stores invalid coordinates in DB

MariaDB [digikam4]> SELECT latitude,latitudeNumber,longitude,longitudeNumber FROM ImagePositions WHERE latitudeNumber>90;
+------------------+--------------------+-----------+--------------------+
| latitude         | latitudeNumber     | longitude | longitudeNumber    |
+------------------+--------------------+-----------+--------------------+
| NULL             |  817.1666666666666 | NULL      |  885.6166666666667 |
| NULL             |  773.9166666666666 | NULL      |  988.2666666666667 |
| 266,38.00000000N |  266.6333333333333 | NULL      | 1455.2833333333333 |
| 267,16.00000000N | 267.26666666666665 | NULL      | 1459.9333333333334 |
| NULL             |  785.0666666666667 | NULL      |  981.0666666666667 |
+------------------+--------------------+-----------+--------------------+

If  I remove XMP GPS coordinates from these photos (exiv2 -v -M 'del Xmp.exif.GPSLongitude' -M 'del Xmp.exif.GPSLatitude') digiKam read correct GPS info from EXIF tags.

Reproducible: Always

Actual Results:  
Photos with XMP GPS tags are not visible in "Map" view and "Map Search" sidepane. digiKam hangs if I try to open Geolocation sidepane for such picture.

Expected Results:  
1. digiKam should validate coordinates before inserting into DB;
2. digiKam should try to read EXIF GPS coordinates if reading XMP GPS coordinates failed.
Comment 1 Alexander Meshcheryakov 2013-08-31 15:46:43 UTC
Created attachment 82067 [details]
Example picture with XMP GPS tags
Comment 2 Alexander Meshcheryakov 2013-08-31 17:21:01 UTC
To prevent accidental hangs of digiKam I've added following trigger to my MySQL DB

CREATE TRIGGER `ImagePositions_BINS` BEFORE INSERT ON ImagePositions FOR EACH ROW
-- Edit trigger body code below this line. Do not edit lines above this one
BEGIN
	DECLARE msg varchar(255);
	IF (NEW.latitudeNumber>90 OR NEW.latitudeNumber<-90) THEN
		SET msg = concat('Latitude out of bounds (', cast(NEW.latitudeNumber AS CHAR), ')');
		SIGNAL sqlstate '45000' SET message_text = msg;
	END IF;
	IF (NEW.longitudeNumber>180 OR NEW.longitudeNumber<-180) THEN
		SET msg = concat('Longitude out of bounds (', cast(NEW.longitudeNumber AS CHAR), ')');
		SIGNAL sqlstate '45000' SET message_text = msg;
	END IF;
END

And similar trigger for BEFORE UPDATE.

Unfortunately, MariaDB does not support CHECK CONSTRAINT unlike SQLite.

I suppose checks for valid coords should be added to standart DB schema.
Comment 3 caulier.gilles 2013-10-31 07:53:13 UTC
digiKam 3.5.0 is out.

Can you give a fresh feedback about your report ? Crash still reproducible ?

Thanks in advance

Gilles Caulier
Comment 4 Alexander Meshcheryakov 2013-10-31 21:51:48 UTC
I can still reproduce this bug with digiKam 3.5.0 and sample picture that I have provided before ("Example picture with XMP GPS tags").
Comment 5 caulier.gilles 2014-05-16 07:29:50 UTC
digiKam 4.0.0 is out :

http://www.digikam.org/node/713

Please check if this entry still valid with this new version.

Thanks in advance

Gilles Caulier
Comment 6 caulier.gilles 2014-08-23 08:49:34 UTC
Following comment #4, i close this file now...
Gilles Caulier