[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - lotuswordpro/source

2020-11-23 Thread Caolán McNamara (via logerrit)
 lotuswordpro/source/filter/lwpcelllayout.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit bd20ad2f2bab67af2777874f4b403314249cfc0b
Author: Caolán McNamara 
AuthorDate: Sun Nov 22 20:13:13 2020 +
Commit: Michael Stahl 
CommitDate: Mon Nov 23 09:51:29 2020 +0100

ofz#27756 null deref

Change-Id: Iccbd368a69f86abe7c7c72df8158db98eaf2bc58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106239
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx 
b/lotuswordpro/source/filter/lwpcelllayout.cxx
index ddf04483817c..3fdcf3caca21 100644
--- a/lotuswordpro/source/filter/lwpcelllayout.cxx
+++ b/lotuswordpro/source/filter/lwpcelllayout.cxx
@@ -71,6 +71,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -350,7 +352,11 @@ LwpPara* LwpCellLayout::GetLastParaOfPreviousStory()
 if (pPreStoryID && !(pPreStoryID->IsNull()))
 {
 LwpStory* pPreStory = 
dynamic_cast(pPreStoryID->obj(VO_STORY).get());
-assert(pPreStory);
+if (!pPreStory)
+{
+SAL_WARN("lwp", "unexpected null VO_STORY");
+return nullptr;
+}
 return 
dynamic_cast(pPreStory->GetLastPara().obj(VO_PARA).get());
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - lotuswordpro/source

2020-10-28 Thread Caolán McNamara (via logerrit)
 lotuswordpro/source/filter/lwptablelayout.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 0795050df0cf79b163c78e048a9f42051e401a61
Author: Caolán McNamara 
AuthorDate: Tue Oct 27 10:12:37 2020 +
Commit: Michael Stahl 
CommitDate: Wed Oct 28 09:38:07 2020 +0100

ofz#26676 null deref

Change-Id: Ic2bd8b49762266ad48263bd68a143b46fb5fd66f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104834
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx 
b/lotuswordpro/source/filter/lwptablelayout.cxx
index 1e371b56426f..00da4c2545d2 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -889,7 +889,14 @@ sal_uInt16 LwpTableLayout::ConvertHeadingRow(
 XFRow* pXFRow = pTmpTable->GetRow(1);
 pXFTable->AddHeaderRow(pXFRow);
 pTmpTable->RemoveRow(1);
-nContentRow = m_RowsMap[0]->GetCurMaxSpannedRows(0,nCol);
+auto iter = m_RowsMap.find(0);
+if (iter == m_RowsMap.end())
+{
+SAL_WARN("lwp", "row 0 is unknown");
+nContentRow = 0;
+}
+else
+nContentRow = iter->second->GetCurMaxSpannedRows(0,nCol);
 }
 }
 return nContentRow;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - lotuswordpro/source

2020-09-24 Thread Caolán McNamara (via logerrit)
 lotuswordpro/source/filter/lwptablelayout.cxx |   14 +++---
 lotuswordpro/source/filter/lwptablelayout.hxx |2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 763bcdfee308ba07d4c8ba8f2a4cc87b2161f69f
Author: Caolán McNamara 
AuthorDate: Wed Sep 23 12:44:14 2020 +0100
Commit: Michael Stahl 
CommitDate: Thu Sep 24 13:31:18 2020 +0200

ofz#25881 use std::vector with bounds checking accessor

Change-Id: Ic557e85bce5f3ebe7224b0aa2192a74969f4fce2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103193
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx 
b/lotuswordpro/source/filter/lwptablelayout.cxx
index bc1541d6bf9b..1e371b56426f 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -865,7 +865,7 @@ sal_uInt16 LwpTableLayout::ConvertHeadingRow(
 ConvertTable(pTmpTable.get(),nStartHeadRow,nEndHeadRow,0,nCol);
 
 sal_uInt16 nRowNum = pTmpTable->GetRowCount();
-std::unique_ptr CellMark( new sal_uInt8[nRowNum] );
+std::vector CellMark(nRowNum);
 
 if (nRowNum == 1)
 {
@@ -877,11 +877,11 @@ sal_uInt16 LwpTableLayout::ConvertHeadingRow(
 else
 {
 sal_uInt8 nFirstColSpann = 1;
-const bool bFindFlag = 
FindSplitColMark(pTmpTable.get(),CellMark.get(),nFirstColSpann);
+const bool bFindFlag = FindSplitColMark(pTmpTable.get(), CellMark, 
nFirstColSpann);
 
 if (bFindFlag)//split to 2 cells
 {
-
SplitRowToCells(pTmpTable.get(),pXFTable,nFirstColSpann,CellMark.get());
+SplitRowToCells(pTmpTable.get(), pXFTable, nFirstColSpann, 
CellMark.data());
 nContentRow = nEndHeadRow;
 }
 else//can not split,the first row will be the heading row,the rest 
will be content row
@@ -997,7 +997,7 @@ void LwpTableLayout::SplitRowToCells(XFTable* pTmpTable, 
rtl::Reference
  * @param  pXFTable - pointer of tmp XFtable
  * @param  CellMark - pointer of cell mark array
  */
-bool  LwpTableLayout::FindSplitColMark(XFTable* pXFTable, sal_uInt8* pCellMark,
+bool  LwpTableLayout::FindSplitColMark(XFTable* pXFTable, 
std::vector& rCellMark,
 sal_uInt8& nMaxColSpan)
 {
 sal_uInt16 nRowNum = pXFTable->GetRowCount();
@@ -1027,7 +1027,7 @@ bool  LwpTableLayout::FindSplitColMark(XFTable* pXFTable, 
sal_uInt8* pCellMark,
 }
 if (nColSpan > nMaxColSpan)
 nMaxColSpan = nColSpan;
-pCellMark[nRowLoop] = 0;//reset all cell mark to zero
+rCellMark.at(nRowLoop) = 0;//reset all cell mark to zero
 }
 
 //find if other row has the same column
@@ -1050,11 +1050,11 @@ bool  LwpTableLayout::FindSplitColMark(XFTable* 
pXFTable, sal_uInt8* pCellMark,
 if (nCellMark == 0)
 break;
 else
-pCellMark[nRowLoop] = nCellMark;
+rCellMark.at(nRowLoop) = nCellMark;
 }
 for(nRowLoop=1;nRowLoop<=nRowNum;nRowLoop++)//check if all ==0,break
 {
-if (pCellMark[nRowLoop] == 0)
+if (rCellMark.at(nRowLoop) == 0)
 break;
 }
 if (nRowLoop == nRowNum+1)
diff --git a/lotuswordpro/source/filter/lwptablelayout.hxx 
b/lotuswordpro/source/filter/lwptablelayout.hxx
index 7852ab9c0b0b..9eebb2b391c1 100644
--- a/lotuswordpro/source/filter/lwptablelayout.hxx
+++ b/lotuswordpro/source/filter/lwptablelayout.hxx
@@ -156,7 +156,7 @@ private:
 sal_uInt8 nEndCol, sal_uInt16 nRowID);
 void ConvertColumn(rtl::Reference const & pXFTable, sal_uInt8 
nStartCol, sal_uInt8 nEndCol);
 sal_uInt16 ConvertHeadingRow(rtl::Reference const & 
pXFTable,sal_uInt16 nStartHeadRow,sal_uInt16 nEndHeadRow);
-static bool FindSplitColMark(XFTable* pXFTable,sal_uInt8* 
pCellMark,sal_uInt8& nMaxColSpan);
+static bool FindSplitColMark(XFTable* pXFTable, std::vector& 
rCellMark, sal_uInt8& nMaxColSpan);
 void SplitRowToCells(XFTable* pTmpTable, rtl::Reference const & 
pXFTable,
 sal_uInt8 nFirstColSpann, const sal_uInt8* pCellMark);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - lotuswordpro/source

2020-06-13 Thread David Tardon (via logerrit)
 lotuswordpro/source/filter/lwpdoc.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 42de309f6dd71811f1aaeea1c3753065b57cfa06
Author: David Tardon 
AuthorDate: Fri Jun 12 16:22:22 2020 +0200
Commit: Caolán McNamara 
CommitDate: Sat Jun 13 15:14:21 2020 +0200

cast to the right type

This makes paragraph formatting in LWP documents work again (for the
first time since 3.3).

Regression from commit d2a1c2d4cfa51b6ee8a7f38baa258633fae9ec6d
"fix what there is to fix"

Change-Id: I057aeb996837f7c19815de8a5379861ce3c0e8cd
(cherry picked from commit 12cb753350f429e39064365b05926a30a008a516)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96235
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/lotuswordpro/source/filter/lwpdoc.cxx 
b/lotuswordpro/source/filter/lwpdoc.cxx
index f59c41827b22..3c887fdb8387 100644
--- a/lotuswordpro/source/filter/lwpdoc.cxx
+++ b/lotuswordpro/source/filter/lwpdoc.cxx
@@ -245,7 +245,7 @@ void LwpDocument::RegisterTextStyles()
 throw std::runtime_error("loop in register text style");
 pParaStyle->SetFoundry(m_xOwnedFoundry.get());
 pParaStyle->RegisterStyle();
-pParaStyle = 
dynamic_cast(pParaStyle->GetNext().obj().get());
+pParaStyle = 
dynamic_cast(pParaStyle->GetNext().obj().get());
 }
 }
 ChangeStyleName();//for click here block
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - lotuswordpro/source

2020-06-11 Thread Caolán McNamara (via logerrit)
 lotuswordpro/source/filter/lwprowlayout.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 37d818a65429cde5b3eb6c5a1a95012894d039d7
Author: Caolán McNamara 
AuthorDate: Thu Jun 11 09:31:44 2020 +0100
Commit: Caolán McNamara 
CommitDate: Thu Jun 11 12:53:02 2020 +0200

ofz#23300 infinite loop

Change-Id: I0ee67e8efefa48942357340cae46bd7ece27e5b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96098
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx 
b/lotuswordpro/source/filter/lwprowlayout.cxx
index 56ea0c98ce33..cb350f891fa1 100644
--- a/lotuswordpro/source/filter/lwprowlayout.cxx
+++ b/lotuswordpro/source/filter/lwprowlayout.cxx
@@ -406,7 +406,10 @@ void 
LwpRowLayout::ConvertCommonRow(rtl::Reference const & pXFTable, sa
 auto nNumCols = pConnCell->GetNumcols();
 if (!nNumCols)
 throw std::runtime_error("loop in conversion");
-nCellEndCol = i + nNumCols - 1;
+auto nNewEndCol = i + nNumCols - 1;
+if (nNewEndCol > std::numeric_limits::max())
+throw std::range_error("column index too large");
+nCellEndCol = nNewEndCol;
 i = nCellEndCol;
 }
 xCell = 
pCellLayout->DoConvertCell(pTable->GetObjectID(),crowid,i);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits