Bug fix: Compute TimeZone data
authorColin Clark <colin.clark@cclark.uk>
Thu, 25 Jul 2019 08:25:28 +0000 (09:25 +0100)
committerKlaus Ethgen <Klaus@Ethgen.de>
Fri, 26 Jul 2019 17:54:44 +0000 (18:54 +0100)
Improved error detection

src/exif-common.c

index fd2c6a3..ce90d73 100644 (file)
@@ -703,6 +703,10 @@ static gboolean exif_build_tz_data(ExifData *exif, gchar **exif_date_time, gchar
                {
                lat_deg = strtok(text_latitude, "deg'");
                lat_min = strtok(NULL, "deg'");
+               if (!lat_deg || !lat_min)
+                       {
+                       return FALSE;
+                       }
                latitude = atof(lat_deg) + atof(lat_min) / 60;
                if (!g_strcmp0(text_latitude_ref, "South"))
                        {
@@ -710,6 +714,10 @@ static gboolean exif_build_tz_data(ExifData *exif, gchar **exif_date_time, gchar
                        }
                lon_deg = strtok(text_longitude, "deg'");
                lon_min = strtok(NULL, "deg'");
+               if (!lon_deg || !lon_min)
+                       {
+                       return FALSE;
+                       }
                longitude = atof(lon_deg) + atof(lon_min) / 60;
                if (!g_strcmp0(text_longitude_ref, "West"))
                        {