evolution r35565 - in branches/gnome-2-22: calendar calendar/gui plugins/itip-formatter
- From: abharath svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r35565 - in branches/gnome-2-22: calendar calendar/gui plugins/itip-formatter
- Date: Mon, 2 Jun 2008 04:22:10 +0000 (UTC)
Author: abharath
Date: Mon Jun 2 04:22:10 2008
New Revision: 35565
URL: http://svn.gnome.org/viewvc/evolution?rev=35565&view=rev
Log:
Committing on behalf of Milan Crha <mcrha redhat com>
2008-05-29 Milan Crha <mcrha redhat com>
** Fix for bug #535459
Modified:
branches/gnome-2-22/calendar/ChangeLog
branches/gnome-2-22/calendar/gui/e-itip-control.c
branches/gnome-2-22/calendar/gui/itip-utils.c
branches/gnome-2-22/calendar/gui/itip-utils.h
branches/gnome-2-22/plugins/itip-formatter/ChangeLog
branches/gnome-2-22/plugins/itip-formatter/itip-formatter.c
Modified: branches/gnome-2-22/calendar/gui/e-itip-control.c
==============================================================================
--- branches/gnome-2-22/calendar/gui/e-itip-control.c (original)
+++ branches/gnome-2-22/calendar/gui/e-itip-control.c Mon Jun 2 04:22:10 2008
@@ -1676,8 +1676,14 @@
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;
}
Modified: branches/gnome-2-22/calendar/gui/itip-utils.c
==============================================================================
--- branches/gnome-2-22/calendar/gui/itip-utils.c (original)
+++ branches/gnome-2-22/calendar/gui/itip-utils.c Mon Jun 2 04:22:10 2008
@@ -1810,3 +1810,26 @@
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);
+}
Modified: branches/gnome-2-22/calendar/gui/itip-utils.h
==============================================================================
--- branches/gnome-2-22/calendar/gui/itip-utils.h (original)
+++ branches/gnome-2-22/calendar/gui/itip-utils.h Mon Jun 2 04:22:10 2008
@@ -51,4 +51,6 @@
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
Modified: branches/gnome-2-22/plugins/itip-formatter/itip-formatter.c
==============================================================================
--- branches/gnome-2-22/plugins/itip-formatter/itip-formatter.c (original)
+++ branches/gnome-2-22/plugins/itip-formatter/itip-formatter.c Mon Jun 2 04:22:10 2008
@@ -1369,11 +1369,16 @@
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;
}
@@ -1846,7 +1851,6 @@
return FALSE;
}
-
static gboolean
in_proper_folder (CamelFolder *folder)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]