[evolution-data-server] Avoid a crash in cal_backend_add_cached_timezone().
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Avoid a crash in cal_backend_add_cached_timezone().
- Date: Wed, 3 Jul 2013 15:42:46 +0000 (UTC)
commit 244003d568113a82628bc74b337274a6e8fee433
Author: Matthew Barnes <mbarnes redhat com>
Date: Wed Jul 3 11:40:39 2013 -0400
Avoid a crash in cal_backend_add_cached_timezone().
Apparently icaltimezone_get_tzid() can sometimes return NULL. Check for
NULL before we use it in a hash table lookup, which crashes on NULL keys.
Add a similar check to ECalClient for consistency.
calendar/libecal/e-cal-client.c | 9 +++++++--
calendar/libedata-cal/e-cal-backend.c | 9 +++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/calendar/libecal/e-cal-client.c b/calendar/libecal/e-cal-client.c
index 2ee4a1f..6ac3828 100644
--- a/calendar/libecal/e-cal-client.c
+++ b/calendar/libecal/e-cal-client.c
@@ -1224,9 +1224,14 @@ cal_client_add_cached_timezone (ETimezoneCache *cache,
priv = E_CAL_CLIENT_GET_PRIVATE (cache);
- g_mutex_lock (&priv->zone_cache_lock);
-
+ /* XXX Apparently this function can sometimes return NULL.
+ * I'm not sure when or why that happens, but we can't
+ * cache the icaltimezone if it has no tzid string. */
tzid = icaltimezone_get_tzid (zone);
+ if (tzid == NULL)
+ return;
+
+ g_mutex_lock (&priv->zone_cache_lock);
/* Avoid replacing an existing cache entry. We don't want to
* invalidate any icaltimezone pointers that may have already
diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c
index c08d481..e1114a0 100644
--- a/calendar/libedata-cal/e-cal-backend.c
+++ b/calendar/libedata-cal/e-cal-backend.c
@@ -600,9 +600,14 @@ cal_backend_add_cached_timezone (ETimezoneCache *cache,
priv = E_CAL_BACKEND_GET_PRIVATE (cache);
- g_mutex_lock (&priv->zone_cache_lock);
-
+ /* XXX Apparently this function can sometimes return NULL.
+ * I'm not sure when or why that happens, but we can't
+ * cache the icaltimezone if it has no tzid string. */
tzid = icaltimezone_get_tzid (zone);
+ if (tzid == NULL)
+ return;
+
+ g_mutex_lock (&priv->zone_cache_lock);
/* Avoid replacing an existing cache entry. We don't want to
* invalidate any icaltimezone pointers that may have already
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]