[evolution-patches] [calendar] patch for #60310
- From: Rodrigo Moya <rodrigo novell com>
- To: Evolution Patches <evolution-patches lists ximian com>
- Subject: [evolution-patches] [calendar] patch for #60310
- Date: Thu, 22 Jul 2004 18:43:42 +0200
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.298
diff -u -p -r1.298 ChangeLog
--- ChangeLog 16 Jul 2004 21:10:04 -0000 1.298
+++ ChangeLog 22 Jul 2004 16:42:52 -0000
@@ -1,3 +1,16 @@
+2004-07-22 Rodrigo Moya <rodrigo novell com>
+
+ Fixes #60310
+
+ * backends/file/e-cal-backend-file.c (e_cal_backend_file_create_object,
+ e_cal_backend_file_modify_object, e_cal_backend_file_receive_objects):
+ check result of e_cal_component_set_icalcomponent() to make sure we
+ don't add invalid objects to our internal struct.
+ (scan_vcalendar): fixed memory leak.
+ (match_recurrence_sexp): if key is NULL, don't try to use the hash
+ table item's value.
+ (match_object_sexp): only try to match recurrences if there are any.
+
2004-07-15 JP Rosevear <jpr novell com>
Fixes #58748
Index: backends/file/e-cal-backend-file.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/file/e-cal-backend-file.c,v
retrieving revision 1.34
diff -u -p -r1.34 e-cal-backend-file.c
--- backends/file/e-cal-backend-file.c 11 Jun 2004 15:54:15 -0000 1.34
+++ backends/file/e-cal-backend-file.c 22 Jul 2004 16:42:53 -0000
@@ -568,9 +568,10 @@ scan_vcalendar (ECalBackendFile *cbfile)
continue;
comp = e_cal_component_new ();
-
- if (!e_cal_component_set_icalcomponent (comp, icalcomp))
+ if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
+ g_object_unref (comp);
continue;
+ }
add_component (cbfile, comp, FALSE);
}
@@ -1156,9 +1157,13 @@ typedef struct {
static void
match_recurrence_sexp (gpointer key, gpointer value, gpointer data)
{
+ char *rid = key;
ECalComponent *comp = value;
MatchObjectData *match_data = data;
+ if (!rid || !*rid)
+ return;
+
if ((!match_data->search_needed) ||
(e_cal_backend_sexp_match_comp (match_data->obj_sexp, comp, match_data->backend))) {
match_data->obj_list = g_list_append (match_data->obj_list,
@@ -1181,9 +1186,11 @@ match_object_sexp (gpointer key, gpointe
}
/* match also recurrences */
- g_hash_table_foreach (obj_data->recurrences,
- (GHFunc) match_recurrence_sexp,
- match_data);
+ if (g_hash_table_size > 0) {
+ g_hash_table_foreach (obj_data->recurrences,
+ (GHFunc) match_recurrence_sexp,
+ match_data);
+ }
}
/* Get_objects_in_range handler for the file backend */
@@ -1661,7 +1668,10 @@ e_cal_backend_file_create_object (ECalBa
/* Create the cal component */
comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomp);
+ if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
+ g_object_unref (comp);
+ return GNOME_Evolution_Calendar_InvalidObject;
+ }
/* Set the created and last modified times on the component */
current = icaltime_from_timet (time (NULL), 0);
@@ -1726,7 +1736,10 @@ e_cal_backend_file_modify_object (ECalBa
/* Create the cal component */
comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomp);
+ if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
+ g_object_unref (comp);
+ return GNOME_Evolution_Calendar_InvalidObject;
+ }
/* Set the last modified time on the component */
current = icaltime_from_timet (time (NULL), 0);
@@ -2115,7 +2128,10 @@ e_cal_backend_file_receive_objects (ECal
/* Create the cal component */
comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, subcomp);
+ if (!e_cal_component_set_icalcomponent (comp, subcomp)) {
+ g_object_unref (comp);
+ continue;
+ }
/* Set the created and last modified times on the component */
current = icaltime_from_timet (time (NULL), 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]