[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sw/qa sw/source

Michael Stahl mstahl at redhat.com
Wed Aug 31 10:20:35 UTC 2016


 sw/qa/core/data/rtf/fail/table-1.rtf |binary
 sw/source/core/unocore/unotext.cxx   |   23 +++++++++++++----------
 2 files changed, 13 insertions(+), 10 deletions(-)

New commits:
commit ad95040240bb8fe1fe56c6143cffcebf51b8b96f
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Aug 30 21:17:32 2016 +0200

    Revert "fftester: non-contiguous cells"
    
    This reverts commit 9accbfa0a52433cf03fe186fc69334d387981eb9.
    
    ... and the code change of "avoid crashing on load of fdo54724-1.rtf"
    commit 4ee3eabd0f058b26544c84b2b5aaf5478d921817.
    
    It's much simpler to detect early in convertToTable that there is a
    row with no cells in it, which should not be allowed.
    
    Change-Id: Iff6d235b29514edd57cc55addeefb24242595d88
    (cherry picked from commit dc83b3ae470914dbcb08fe1f0a4a4e1a1d3d8e19)
    Reviewed-on: https://gerrit.libreoffice.org/28512
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 217640264a62bd78b153b131b2cd158d4f8da620)
    Reviewed-on: https://gerrit.libreoffice.org/28539

diff --git a/sw/qa/core/data/rtf/fail/table-1.rtf b/sw/qa/core/data/rtf/fail/table-1.rtf
new file mode 100644
index 0000000..c333a10
Binary files /dev/null and b/sw/qa/core/data/rtf/fail/table-1.rtf differ
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 0821389..454dda6 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2236,20 +2236,23 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
             pTableRanges[nRow].getConstArray();
         const sal_Int32 nCells(pTableRanges[nRow].getLength());
 
+        if (0 == nCells) // this would lead to no pLastCell below
+        {                // and make it impossible to detect node gaps
+            bExcept = true;
+            break;
+        }
+
         for (sal_Int32 nCell = 0; nCell < nCells; ++nCell)
         {
-            SwNodeRange *pLastCell;
-            if (nCell == 0 && nRow == 0)
-            {
-                pLastCell = nullptr;
-            }
-            else
-            {
-                std::vector<SwNodeRange>& rRowOfPrevCell = nCell ? aRowNodes : *aTableNodes.rbegin();
-                pLastCell = !rRowOfPrevCell.empty() ? &*rRowOfPrevCell.rbegin() : nullptr;
-            }
+            SwNodeRange *const pLastCell(
+                (nCell == 0)
+                    ? ((nRow == 0)
+                        ? nullptr
+                        : &*aTableNodes.rbegin()->rbegin())
+                    : &*aRowNodes.rbegin());
             m_pImpl->ConvertCell(pRow[nCell], aRowNodes, pLastCell, bExcept);
         }
+        assert(bExcept || !aRowNodes.empty());
         aTableNodes.push_back(aRowNodes);
     }
 


More information about the Libreoffice-commits mailing list