Bug 129474

Summary: Korganizer stalls when reading iCalendar file with an apparently invalid entry
Product: [Applications] korganizer Reporter: Robert Miesen <bobby_miesen>
Component: generalAssignee: Reinhold Kainhofer <reinhold>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: 3.5   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Robert Miesen 2006-06-20 10:36:01 UTC
Version:           3.5 (using KDE 3.5.3, Debian Package 4:3.5.3-1 (testing/unstable))
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.15-1-686

When I tried to open up my iCalender file that contains all of my calander and todo information, it stalls (starts running in an infinity loop) when it attempts to read some entry like this:


BEGIN:VTODO
DTSTAMP:20060612T050057Z
ORGANIZER;CN=Robert Miesen:MAILTO:bobby_miesen@yahoo.com
CREATED:20060403T210310Z
UID:KOrganizer-2087030587.414
SEQUENCE:20
LAST-MODIFIED:20060612T001956Z
SUMMARY:Add Homework for CST 223P
CLASS:PUBLIC
PRIORITY:5
CATEGORIES:Academic
RRULE:FREQ=WEEKLY;UNTIL=20060612;BYDAY=MO
DUE;VALUE=DATE:20060410
DTSTART;VALUE=DATE:29350930228
COMPLETED:20060612T001956Z
PERCENT-COMPLETE:100
RECURRENCE-ID:20060612T070000Z
BEGIN:VALARM
DESCRIPTION:
ACTION:DISPLAY
TRIGGER;VALUE=DURATION:-PT2H
END:VALARM

END:VTODO



It seems to only respond to SIGTERM or SIGKILL when it stalls like this. The size of my iCalendar file is roughly 124,971 Bytes.
Comment 1 Robert Miesen 2006-07-13 08:50:51 UTC
I later found out why this happens. Here's why:

When you set up a reoccurring task to to cease repeating after a certain date (like, say, July 12th, 2006) and after that date passes, the bug shows itself and ruins your day.
Comment 2 Susumu Katayama 2006-09-05 08:12:42 UTC
I suffered from the same bug, too. I, like the reporter I guess, experienced difficulty identifying the resposible entry. One can easily confirm that KOrganizer enters an infinite loop by wrapping the reported VTODO entry with usual VCALENDAR entry and letting KOrganizer read it as an iCalendar file.

If it is difficult to identify what bug generated the entry, it would be nice if KOrganizer could check the validity of entries while reading iCalendar files if possible, so it would not at least enter the infinite loop.
Comment 3 Bram Schoenmakers 2006-10-29 01:40:41 UTC
SVN commit 599882 by bram:

Prevent infinite loops with some cases of recurring todos.

BUG:103761
BUG:129474



 M  +9 -3      todo.cpp  


--- branches/KDE/3.5/kdepim/libkcal/todo.cpp #599881:599882
@@ -275,11 +275,17 @@
 
     if ( ( r->duration() == -1 || ( nextDate.isValid() && endDateTime.isValid()
            && nextDate <= endDateTime ) ) ) {
-      setDtDue( nextDate );
-      while ( !recursAt( dtDue() ) || dtDue() <= QDateTime::currentDateTime() ) {
-        setDtDue( r->getNextDateTime( dtDue() ) );
+
+      while ( !recursAt( nextDate ) || nextDate <= QDateTime::currentDateTime() ) {
+
+        if ( !nextDate.isValid() || nextDate > endDateTime ) {
+          return false;
+        }
+
+        nextDate = r->getNextDateTime( nextDate );
       }
 
+      setDtDue( nextDate );
       setCompleted( false );
       setRevision( revision() + 1 );