Bug 104431

Summary: kword crashes when trying to open a file
Product: [Unmaintained] kword Reporter: turbidostato <jmnavarrol>
Component: generalAssignee: Thomas Zander <zander>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: the offending crashing file

Description turbidostato 2005-04-23 18:52:53 UTC
Version:            (using KDE KDE 3.3.2)
Installed from:    Debian testing/unstable Packages

Kword 1.3.5.  It crashes when trying to open a kwd file generated with that same version.

Trying to open it with kword 1.3.4 or with 1.3.5 on a different computers gives the same results.

Error returned is:
ASSERT: "fs" in ../../kword/kwdoc.cc (2054)
KCrash: Application 'kword' crashing...

I unzip the kwd file and there are no signs of the kwd file being corrupted.
Comment 1 turbidostato 2005-04-23 18:54:29 UTC
Created attachment 10767 [details]
the offending crashing file

This file is the one that makes kword 1.3.5 crash.
Comment 2 David Faure 2005-04-24 02:51:12 UTC
CVS commit by faure: 

Don't crash when a file has a footnote referring to a non-existing frame
BUG: 104431


  M +2 -0      kwdoc.cc   1.744


--- koffice/kword/kwdoc.cc  #1.743:1.744
@@ -2313,4 +2313,6 @@ bool KWDocument::processFootNoteRequests
         KWFrameSet * fs = frameSetByName( fsname );
         Q_ASSERT( fs );
+        if ( !fs ) // #104431
+            continue;
         Q_ASSERT( fs->type() == FT_TEXT );
         Q_ASSERT( fs->frameSetInfo() == KWFrameSet::FI_FOOTNOTE );
Comment 3 turbidostato 2005-04-26 04:06:54 UTC
Sorry, your patch doesn't work.  While now you can open the file, kword crashes if you modify the document and try to save it again.

Kword crashes too if you try to select all (Ctrl-A) to copy the text to a new document.

It seems that kword managed to malform the document in a way it cannot cope with.
Comment 4 Sven Lueppken 2005-05-04 17:47:42 UTC
SVN commit 409282 by lueppken:

Adding a nullpointer-check to fix bug #104431.

BUG: 104431


 M  +2 -1      trunk/koffice/kword/kwvariable.cc  


--- trunk/koffice/kword/kwvariable.cc #409281:409282
@@ -349,7 +349,8 @@
     footnoteElem.setAttribute( "notetype", m_noteType == FootNote ? "footnote" : "endnote" );
     footnoteElem.setAttribute( "numberingtype", m_numberingType == Auto ? "auto" : "manual" );
     Q_ASSERT( m_frameset );
-    footnoteElem.setAttribute( "frameset", m_frameset->getName() );
+    if( m_frameset )
+      footnoteElem.setAttribute( "frameset", m_frameset->getName() );
 }
 
 void KWFootNoteVariable::load( QDomElement &elem )