sw/qa/extras/ooxmlimport/data/file_crash.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx      |    5 +++++
 sw/source/core/doc/doctxm.cxx                 |    2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 247edcf4fe8e7c624fda74b9e9d1658da2785a34
Author: PriyankaGaikwad <priyanka.gaik...@synerzip.com>
Date:   Fri Nov 22 19:05:32 2013 +0530

    Fixed for libreoffice crashes while opening file.
    
    Change-Id: I85a16e4ef8d75f19250115d5522046a968d5fc91
    Reviewed-on: https://gerrit.libreoffice.org/6760
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>
    (cherry picked from commit c6e333e73b811a65526628effb21636f4f420cc5)

diff --git a/sw/qa/extras/ooxmlimport/data/file_crash.docx 
b/sw/qa/extras/ooxmlimport/data/file_crash.docx
new file mode 100644
index 0000000..7a233ab
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/file_crash.docx 
differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index d8ca06f..d957b98 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1540,6 +1540,11 @@ DECLARE_OOXMLIMPORT_TEST(testFdo70457, "fdo70457.docx")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(4500), getProperty<sal_Int32>(getShape(1), 
"RotateAngle"));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testLOCrash,"file_crash.docx")
+{
+    //The problem was libreoffice crash while opening the file.
+    getParagraph(1,"Contents");
+}
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index e28617d..bece385 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1616,7 +1616,7 @@ void SwTOXBaseSection::GenerateText( sal_uInt16 nArrayIdx,
 
             case TOKEN_ENTRY_TEXT:
                 {
-                    SwIndex aIdx( pTOXNd, rTxt.getLength() );
+                    SwIndex aIdx( pTOXNd, 
std::min(pTOXNd->GetTxt().getLength(),rTxt.getLength()) );
                     rBase.FillText( *pTOXNd, aIdx );
                     rTxt = lcl_RemoveLineBreaks(rTxt);
                 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to