aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2008-06-02 12:24:36 +0800
committerBharath Acharya <abharath@src.gnome.org>2008-06-02 12:24:36 +0800
commit851c7fac433e4c5a5ac04398c89480f4500c30a9 (patch)
tree54b0c95289313e4366f98073ec4d2b2037d396ac
parentcef99d25f5913db5b8a4b4d6389920064a41dd26 (diff)
downloadgsoc2013-evolution-851c7fac433e4c5a5ac04398c89480f4500c30a9.tar
gsoc2013-evolution-851c7fac433e4c5a5ac04398c89480f4500c30a9.tar.gz
gsoc2013-evolution-851c7fac433e4c5a5ac04398c89480f4500c30a9.tar.bz2
gsoc2013-evolution-851c7fac433e4c5a5ac04398c89480f4500c30a9.tar.lz
gsoc2013-evolution-851c7fac433e4c5a5ac04398c89480f4500c30a9.tar.xz
gsoc2013-evolution-851c7fac433e4c5a5ac04398c89480f4500c30a9.tar.zst
gsoc2013-evolution-851c7fac433e4c5a5ac04398c89480f4500c30a9.zip
Committing on behalf of Milan Crha <mcrha@redhat.com>
2008-05-29 Milan Crha <mcrha@redhat.com> ** Fix for bug #535459 svn path=/trunk/; revision=35566
-rw-r--r--calendar/ChangeLog10
-rw-r--r--calendar/gui/e-itip-control.c8
-rw-r--r--calendar/gui/itip-utils.c23
-rw-r--r--calendar/gui/itip-utils.h2
-rw-r--r--plugins/itip-formatter/ChangeLog7
-rw-r--r--plugins/itip-formatter/itip-formatter.c8
6 files changed, 55 insertions, 3 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 9b0b915d71..01a3f216ea 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,13 @@
+2008-05-29 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #535459
+
+ * gui/itip-utils.h: (is_icalcomp_valid):
+ * gui/itip-utils.c: (is_icalcomp_valid), (check_time):
+ New function to make some sanity checks on component properties.
+ * gui/e-itip-control.c: (e_itip_control_set_data):
+ Do not use component when sanity check fails.
+
2008-05-23 Matthew Barnes <mbarnes@redhat.com>
** Fixes part of bug #534476
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index 81a2458106..f574d86b06 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -1676,8 +1676,14 @@ e_itip_control_set_data (EItipControl *itip, const gchar *text)
priv->top_level = e_cal_util_new_top_level ();
priv->main_comp = icalparser_parse_string (priv->vcalendar);
- if (priv->main_comp == NULL) {
+ if (priv->main_comp == NULL || !is_icalcomp_valid (priv->main_comp)) {
write_error_html (itip, _("The attachment does not contain a valid calendar message"));
+
+ if (priv->main_comp) {
+ icalcomponent_free (priv->main_comp);
+ priv->main_comp = NULL;
+ }
+
return;
}
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index e529042051..cddb3d9b4f 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -1666,3 +1666,26 @@ itip_publish_comp (ECal *client, gchar *uri, gchar *username,
return TRUE;
}
+static gboolean
+check_time (const struct icaltimetype tmval, gboolean can_null_time)
+{
+ if (icaltime_is_null_time (tmval))
+ return can_null_time;
+
+ return icaltime_is_valid_time (tmval) &&
+ tmval.month >= 1 && tmval.month <= 12 &&
+ tmval.day >= 1 && tmval.day <= 31 &&
+ tmval.hour >= 0 && tmval.hour < 24 &&
+ tmval.minute >= 0 && tmval.minute < 60 &&
+ tmval.second >= 0 && tmval.second < 60;
+}
+
+/* returns whether the passed-in icalcomponent is valid or not. It does some sanity checks on values too. */
+gboolean
+is_icalcomp_valid (icalcomponent *icalcomp)
+{
+ return icalcomp &&
+ icalcomponent_is_valid (icalcomp) &&
+ check_time (icalcomponent_get_dtstart (icalcomp), FALSE) &&
+ check_time (icalcomponent_get_dtend (icalcomp), TRUE);
+}
diff --git a/calendar/gui/itip-utils.h b/calendar/gui/itip-utils.h
index e7014c9f47..1e8ebc2849 100644
--- a/calendar/gui/itip-utils.h
+++ b/calendar/gui/itip-utils.h
@@ -51,4 +51,6 @@ gboolean itip_publish_begin (ECalComponent *pub_comp, ECal *client,
gboolean reply_to_calendar_comp (ECalComponentItipMethod method, ECalComponent *send_comp,
ECal *client, gboolean reply_all, icalcomponent *zones, GSList *attachments_list);
+gboolean is_icalcomp_valid (icalcomponent *icalcomp);
+
#endif
diff --git a/plugins/itip-formatter/ChangeLog b/plugins/itip-formatter/ChangeLog
index 5befbf33a1..fbcd25aa96 100644
--- a/plugins/itip-formatter/ChangeLog
+++ b/plugins/itip-formatter/ChangeLog
@@ -1,3 +1,10 @@
+2008-05-29 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #535459
+
+ * itip-formatter.c: (extract_itip_data):
+ Do not use component when sanity check fails.
+
2008-05-22 Matthew Barnes <mbarnes@redhat.com>
** Fixes part of bug #534360
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 55b182752d..b40c6519e2 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -1372,11 +1372,16 @@ extract_itip_data (struct _itip_puri *pitip, GtkContainer *container)
pitip->top_level = e_cal_util_new_top_level ();
pitip->main_comp = icalparser_parse_string (pitip->vcalendar);
- if (pitip->main_comp == NULL) {
+ if (pitip->main_comp == NULL || !is_icalcomp_valid (pitip->main_comp)) {
set_itip_error (pitip, container,
_("The calendar attached is not valid"),
_("The message claims to contain a calendar, but the calendar is not a valid iCalendar."));
+ if (pitip->main_comp) {
+ icalcomponent_free (pitip->main_comp);
+ pitip->main_comp = NULL;
+ }
+
return FALSE;
}
@@ -1849,7 +1854,6 @@ check_is_instance (icalcomponent *icalcomp)
return FALSE;
}
-
static gboolean
in_proper_folder (CamelFolder *folder)
{