patch#3: intermittent crasher bug


Subject: patch#3: intermittent crasher bug
From: Patrick Lam (plam@plam.lcs.mit.edu)
Date: Sun Apr 08 2001 - 20:42:58 CDT


If you repeatedly paste something, AbiWord tends to eventually segfault.
That's not cool at all. I think this is because the buffer is allocated
with one byte too little: no memory is allocated for the trailing zero.
Here's a patch to ie_exp::writeFile.

pat

Index: src/wp/impexp/xp/ie_exp.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_exp.cpp,v
retrieving revision 1.37
diff -u -r1.37 ie_exp.cpp
--- src/wp/impexp/xp/ie_exp.cpp 2001/03/29 17:37:02 1.37
+++ src/wp/impexp/xp/ie_exp.cpp 2001/04/09 01:22:24
@@ -236,8 +237,13 @@

        m_pDocRange = pDocRange;
        m_pByteBuf = pBuf;
+
+ UT_Error err = _writeDocument();
+
+ // write trailing zero to byte buffer (not required for file)
+ write("",1);

- return _writeDocument();
+ return err;
 }

 //////////////////////////////////////////////////////////////////



This archive was generated by hypermail 2b25 : Sun Apr 08 2001 - 20:46:08 CDT