Index: calendar/gui/alarm-notify/config-data.c
===================================================================
--- calendar/gui/alarm-notify/config-data.c	(revision 37482)
+++ calendar/gui/alarm-notify/config-data.c	(working copy)
@@ -259,7 +259,7 @@ void
 config_data_set_last_notification_time (time_t t)
 {
 	GConfClient *client;
-	time_t current_t;
+	time_t current_t, now = time (NULL);
 
 	g_return_if_fail (t != -1);
 
@@ -269,7 +269,7 @@ config_data_set_last_notification_time (
 	/* we only store the new notification time if it is bigger
 	   than the already stored one */
 	current_t = gconf_client_get_int (client, KEY_LAST_NOTIFICATION_TIME, NULL);
-	if (t > current_t)
+	if (t > current_t || current_t > now)
 		gconf_client_set_int (client, KEY_LAST_NOTIFICATION_TIME, t, NULL);
 }
 
@@ -290,8 +290,14 @@ config_data_get_last_notification_time (
 		return -1;
 
 	value = gconf_client_get_without_default (client, KEY_LAST_NOTIFICATION_TIME, NULL);
-	if (value)
-		return (time_t) gconf_value_get_int (value);
+	if (value) {
+		time_t val = (time_t) gconf_value_get_int (value), now = time (NULL);
+
+		if (val > now)
+			val = now;
+
+		return val;
+	}
 
 	return time (NULL);
 }
Index: calendar/ChangeLog
===================================================================
--- calendar/ChangeLog	(revision 37482)
+++ calendar/ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2009-04-06  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #491755
+
+	* gui/alarm-notify/config-data.c:
+	(config_data_set_last_notification_time),
+	(config_data_get_last_notification_time):
+	Sanitize values from GConf before using them.
+
 2009-03-06  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #401346
