configure.ac | 2 sc/source/ui/docshell/impex.cxx | 10 +++ sw/source/core/doc/DocumentRedlineManager.cxx | 66 ++++++++++++-------------- sw/source/core/inc/DocumentRedlineManager.hxx | 1 4 files changed, 42 insertions(+), 37 deletions(-)
New commits: commit 165cd6a40ab4a53ac273e2a4500f82a3249b855a Author: Andras Timar <andras.ti...@collabora.com> Date: Tue Sep 19 22:52:15 2017 +0200 Bump version to 5.3-26 Change-Id: I0108167312db0063f4bdd5e6807c5d5017a32e07 diff --git a/configure.ac b/configure.ac index e9ada24e891f..7a8ae6e1f085 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl in order to create a configure script. # several non-alphanumeric characters, those are split off and used only for the # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea. -AC_INIT([Collabora Office],[5.3.10.25],[],[],[https://collaboraoffice.com/]) +AC_INIT([Collabora Office],[5.3.10.26],[],[],[https://collaboraoffice.com/]) AC_PREREQ([2.59]) commit 284193dbc07f4514af05d64d9cdf640a95158a78 Author: Michael Stahl <mst...@redhat.com> Date: Fri Sep 15 13:51:04 2017 +0200 ofz#3301 sw: DeleteAndJoin found yet another way to delete new redline Not only can that happen in CompressRedlines(), it can also happen in the SwComparePosition::Outside case when the DeleteRedline() decides in particular circumstances to split up the inserted new redline. Arguably it's wrong to split up the new redline in this case; not sure if that ever happens in a legitimate use case though. Avoid this by removing the hack to temporarily insert the new redline and instead create a temporary SwUnoCursor that will be corrected on behalf of the new redline, while the new redline is parked on a safe node. This not only avoids the crash on this file but also makes the "corrupted redline table" assertions go away. Change-Id: I478f4cfc53a19d2cf2f0937f631962f80b1815ff Reviewed-on: https://gerrit.libreoffice.org/42408 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit a562be54f3127f4e22a3a38e62db2b38d48499f3) diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index f2d51192759d..c5da74836240 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -27,6 +27,7 @@ #include <docary.hxx> #include <ndtxt.hxx> #include <comcore.hrc> +#include <unocrsr.hxx> #include <swmodule.hxx> #include <editsh.hxx> #include <vcl/layout.hxx> @@ -575,6 +576,32 @@ namespace } } } + + /// in case some text is deleted, ensure that the not-yet-inserted + /// SwRangeRedline has its positions corrected not to point to deleted node + class TemporaryRedlineUpdater + { + private: + SwRangeRedline & m_rRedline; + std::shared_ptr<SwUnoCursor> m_pCursor; + public: + TemporaryRedlineUpdater(SwDoc & rDoc, SwRangeRedline & rRedline) + : m_rRedline(rRedline) + , m_pCursor(rDoc.CreateUnoCursor(*rRedline.GetPoint(), false)) + { + if (m_rRedline.HasMark()) + { + m_pCursor->SetMark(); + *m_pCursor->GetMark() = *m_rRedline.GetMark(); + *m_rRedline.GetMark() = SwPosition(rDoc.GetNodes().GetEndOfContent()); + } + *m_rRedline.GetPoint() = SwPosition(rDoc.GetNodes().GetEndOfContent()); + } + ~TemporaryRedlineUpdater() + { + static_cast<SwPaM&>(m_rRedline) = *m_pCursor; + } + }; } namespace sw @@ -1223,19 +1250,11 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall { mpRedlineTable->Remove( n ); bDec = true; - // We insert temporarily so that pNew is - // also dealt with when moving the indices. if( bCallDelete ) { - ::comphelper::FlagGuard g(m_isForbidCompressRedlines); - mpRedlineTable->Insert( pNewRedl ); + TemporaryRedlineUpdater const u(m_rDoc, *pNewRedl); m_rDoc.getIDocumentContentOperations().DeleteAndJoin( *pRedl ); - if( !mpRedlineTable->Remove( pNewRedl ) ) - { - assert(false); // can't happen - pNewRedl = nullptr; - } - bCompress = true; // delayed compress + n = 0; // re-initialize } delete pRedl; } @@ -1257,17 +1276,8 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall if( bCallDelete ) { - // We insert temporarily so that pNew is - // also dealt with when moving the indices. - ::comphelper::FlagGuard g(m_isForbidCompressRedlines); - mpRedlineTable->Insert( pNewRedl ); + TemporaryRedlineUpdater const u(m_rDoc, *pNewRedl); m_rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam ); - if( !mpRedlineTable->Remove( pNewRedl ) ) - { - assert(false); // can't happen - pNewRedl = nullptr; - } - bCompress = true; // delayed compress n = 0; // re-initialize } bDec = true; @@ -1288,17 +1298,8 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall if( bCallDelete ) { - // We insert temporarily so that pNew is - // also dealt with when moving the indices. - ::comphelper::FlagGuard g(m_isForbidCompressRedlines); - mpRedlineTable->Insert( pNewRedl ); + TemporaryRedlineUpdater const u(m_rDoc, *pNewRedl); m_rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam ); - if( !mpRedlineTable->Remove( pNewRedl ) ) - { - assert(false); // can't happen - pNewRedl = nullptr; - } - bCompress = true; // delayed compress n = 0; // re-initialize bDec = true; } @@ -1793,11 +1794,6 @@ bool DocumentRedlineManager::AppendTableCellRedline( SwTableCellRedline* pNewRed void DocumentRedlineManager::CompressRedlines() { - if (m_isForbidCompressRedlines) - { - return; - } - CHECK_REDLINE( *this ) void (SwRangeRedline::*pFnc)(sal_uInt16, size_t) = nullptr; diff --git a/sw/source/core/inc/DocumentRedlineManager.hxx b/sw/source/core/inc/DocumentRedlineManager.hxx index 999cbd7137ce..bdcd45c5fc67 100644 --- a/sw/source/core/inc/DocumentRedlineManager.hxx +++ b/sw/source/core/inc/DocumentRedlineManager.hxx @@ -137,7 +137,6 @@ private: sal_uInt16 mnAutoFormatRedlnCommentNo; /**< SeqNo for conjoining of AutoFormat-Redlines. by the UI. Managed by SwAutoFormat! */ css::uno::Sequence <sal_Int8 > maRedlinePasswd; - bool m_isForbidCompressRedlines = false; }; } commit e67e1e73958c013371d89699a6512e96962d7f52 Author: Caolán McNamara <caol...@redhat.com> Date: Mon Sep 18 15:40:16 2017 +0100 ofz#3412 SYLK import: check ;X;Y;C;R col/row validity early Change-Id: I91fcd2571e528201e01467f3bcdbbff30cdfb50c Reviewed-on: https://gerrit.libreoffice.org/42426 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> (cherry picked from commit 51854f5432de42bcc1154469edb5395328870613) diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 7aa39d385a9c..a65f985541e6 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1917,9 +1917,19 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) { case 'X': nCol = static_cast<SCCOL>(OUString(p).toInt32()) + nStartCol - 1; + if (nCol < 0 || MAXCOL < nCol) + { + SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - ;X invalid nCol=" << nCol); + nCol = std::max<SCCOL>( 0, std::min<SCCOL>( nCol, MAXCOL)); + } break; case 'Y': nRow = OUString(p).toInt32() + nStartRow - 1; + if (nRow < 0 || MAXROW < nRow) + { + SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - ;Y invalid nRow=" << nRow); + nRow = std::max<SCROW>( 0, std::min<SCROW>( nRow, MAXROW)); + } break; case 'P' : if ( bData )
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits