Skip to content

libtracker-extract: Don't abort on files with duff GPS data

Andrew Clayton requested to merge ac000/tracker-miners:no-abort into master

I have various image files that were created with a slide scanner. for whatever reason the scanner has put in some bogus GPS data, here is an example of that data output from exiv2

0x8825 Image GPSTag Long 1 42674 0x0000 GPSInfo GPSVersionID Byte 4 2 2 0 0 0x0001 GPSInfo GPSLatitudeRef Ascii 4 N 0x0002 GPSInfo GPSLatitude Rational 3 0/1 0/1 0/1 0x0003 GPSInfo GPSLongitudeRef Ascii 4 E 0x0004 GPSInfo GPSLongitude Rational 3 0/1 0/1 0/1 0x0005 GPSInfo GPSAltitudeRef Byte 4 0 0 0 0 0x0006 GPSInfo GPSAltitude Rational 1 0/1 0x0007 GPSInfo GPSTimeStamp Rational 3 0/1 0/1 0/1 0x001d GPSInfo GPSDateStamp Ascii 12 2011:01:01 0

which results in the following

(tracker-extract-3:22459): Tracker-ERROR **: 22:30:02.545: Invalid GPS Ref entry!

and the process promptly core dumps, this happens every time I login...

Tracing with GDB, this seems to trip up the

if (refentry->format == EXIF_FORMAT_ASCII && (refentry->size == 2)) {

check in src/libtracker-extract/tracker-exif.c::get_gps_coordinate() with refentry->size being 4 in this case and thus falling through to a g_error() call.

I don't see why this should cause the whole process to abort. Indeed it didn't use to, this g_error() code path was only added about a year ago by commit ec89eb5e ("add error messages in case of unknown GPS ref format").

Unfortunately it doesn't state the rationale for using g_error(), so rather than simply reverting that, change it to a g_warning() which I see is used plenty already.

Merge request reports