[Libreoffice-commits] core.git: 5 commits - sfx2/source svtools/source sw/source
Caolán McNamara
caolanm at redhat.com
Fri Apr 18 04:22:10 PDT 2014
sfx2/source/appl/newhelp.cxx | 2 +-
sfx2/source/control/thumbnailview.cxx | 2 +-
svtools/source/control/valueset.cxx | 4 ++--
sw/source/core/docnode/ndtbl.cxx | 6 ++++--
sw/source/core/edit/editsh.cxx | 21 +++++++++++++++++----
5 files changed, 25 insertions(+), 10 deletions(-)
New commits:
commit 71e71d4b5a9e8f92fc6cdb743d960145600aee46
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 18 12:11:09 2014 +0100
coverity#1202830 Out-of-bounds access
Change-Id: I25edea176b69c1c1f87bdbff790a39298a813660
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 8f2d13a..dde9409 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -798,12 +798,25 @@ void SwEditShell::SetNumberingRestart()
SwTxtNode* pTxtNd( static_cast<SwTxtNode*>(pNd) );
SwNumRule* pNumRule( pTxtNd->GetNumRule() );
- if ( pNumRule && pTxtNd->GetNum() &&
+ bool bIsNodeNum =
+ ( pNumRule && pTxtNd->GetNum() &&
( pTxtNd->HasNumber() || pTxtNd->HasBullet() ) &&
pTxtNd->IsCountedInList() &&
- !pTxtNd->IsListRestart() &&
- pTxtNd->GetNum()->GetNumber() ==
- pNumRule->Get( static_cast<sal_uInt16>(pTxtNd->GetActualListLevel()) ).GetStart() )
+ !pTxtNd->IsListRestart() );
+ if (bIsNodeNum)
+ {
+ int nListLevel = pTxtNd->GetActualListLevel();
+
+ if (nListLevel < 0)
+ nListLevel = 0;
+
+ if (nListLevel >= MAXLEVEL)
+ nListLevel = MAXLEVEL - 1;
+
+ bIsNodeNum = pTxtNd->GetNum()->GetNumber() ==
+ pNumRule->Get( static_cast<sal_uInt16>(nListLevel) ).GetStart();
+ }
+ if (bIsNodeNum)
{
// now set a the start value as attribute
SwPosition aCurrentNode(*pNd);
commit 635823696f07956dda22bcc584bd4a133476710c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 18 11:57:25 2014 +0100
coverity#1202785 Division or modulo by zero
Change-Id: I5ede52be101a7603d4edad30b7a1f8ee0fc4b07d
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index b54060d..4bfa3f3 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -2784,7 +2784,7 @@ void SfxHelpWindow_Impl::InitSizes()
else
{
nCollapseWidth = aRect.Width;
- nExpandWidth = nCollapseWidth * 100 / nTextSize;
+ nExpandWidth = nTextSize ? nCollapseWidth * 100 / nTextSize : 0;
}
}
}
commit 12c0d40f82edb6bcc49cb3aa537fade6277047b8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 18 11:56:20 2014 +0100
coverity#1202784 Division or modulo by zero
Change-Id: I982b72abd92584b9ed97de593c17f2cf0b8b3667
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 3326334..a6115fd 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -723,7 +723,7 @@ void ThumbnailView::MakeItemVisible( sal_uInt16 nItemId )
bFound = true;
}
}
- sal_uInt16 nRow = nPos / mnCols;
+ sal_uInt16 nRow = mnCols ? nPos / mnCols : 0;
// Move the visible rows as little as possible to include that one
if ( nRow < mnFirstLine )
commit 902cafe656a017b996e72313274e412bfa0ba838
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 18 11:54:31 2014 +0100
coverity#1202783 Division or modulo by zero
Change-Id: I183416ad3db39108e52c1e69b60fb547448b21a8
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index dde1579..b649278 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -1736,8 +1736,8 @@ Rectangle ValueSet::ImplGetItemRect( size_t nPos ) const
nPos -= nVisibleBegin;
- const size_t row = nPos/mnCols;
- const size_t col = nPos%mnCols;
+ const size_t row = mnCols ? nPos/mnCols : 0;
+ const size_t col = mnCols ? nPos%mnCols : 0;
const long x = maItemListRect.Left()+col*(mnItemWidth+mnSpacing);
const long y = maItemListRect.Top()+row*(mnItemHeight+mnSpacing);
commit b061dbd76bc3a09edd42b5e580a80ae93d62eb1b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 18 11:49:21 2014 +0100
coverity#704523 Division or modulo by zero
and coverity#704522
Change-Id: Ieccd4c4e16a14ea68f8b4879232924a1d05e29ea
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 7aafb95..7132396 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -977,7 +977,8 @@ lcl_SetTableBoxWidths(SwTable & rTable, size_t const nMaxBoxes,
}
else
{
- rBoxFmt.SetFmtAttr(SwFmtFrmSize(ATT_VAR_SIZE, USHRT_MAX / nMaxBoxes));
+ size_t nWidth = nMaxBoxes ? USHRT_MAX / nMaxBoxes : USHRT_MAX;
+ rBoxFmt.SetFmtAttr(SwFmtFrmSize(ATT_VAR_SIZE, nWidth));
}
}
@@ -1310,8 +1311,9 @@ lcl_SetTableBoxWidths2(SwTable & rTable, size_t const nMaxBoxes,
pNewFmt->Add(rBoxes.back());
}
}
+ size_t nWidth = nMaxBoxes ? USHRT_MAX / nMaxBoxes : USHRT_MAX;
// default width for all boxes not at the end of an incomplete line
- rBoxFmt.SetFmtAttr(SwFmtFrmSize(ATT_VAR_SIZE, USHRT_MAX / nMaxBoxes));
+ rBoxFmt.SetFmtAttr(SwFmtFrmSize(ATT_VAR_SIZE, nWidth));
}
SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes,
More information about the Libreoffice-commits
mailing list