summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-10-11 20:45:22 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-10-11 21:10:05 +0100
commitdace560b350346b9f9a102ee602bb129a008bcfe (patch)
treecdf21b4445e6a3302866fa04270c5bd87bb0ba5e
parent78e0d07b6250ba441bae2c7517ed973d99bbd0b3 (diff)
CID#736194 out of bounds
Change-Id: I236c2f51716bfebd0c132bbaed50c1f1ec811ffa
-rw-r--r--sw/source/core/text/txtfld.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index f83059477830..0133de7504c4 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -395,7 +395,15 @@ SwNumberPortion *SwTxtFormatter::NewNumberPortion( SwTxtFormatInfo &rInf ) const
// hat ein "gueltige" Nummer ?
if( pTxtNd->IsNumbered() && pTxtNd->IsCountedInList())
{
- const SwNumFmt &rNumFmt = pNumRule->Get( static_cast<sal_uInt16>(pTxtNd->GetActualListLevel()) );
+ int nLevel = pTxtNd->GetActualListLevel();
+
+ if (nLevel < 0)
+ nLevel = 0;
+
+ if (nLevel >= MAXLEVEL)
+ nLevel = MAXLEVEL - 1;
+
+ const SwNumFmt &rNumFmt = pNumRule->Get( nLevel );
const sal_Bool bLeft = SVX_ADJUST_LEFT == rNumFmt.GetNumAdjust();
const sal_Bool bCenter = SVX_ADJUST_CENTER == rNumFmt.GetNumAdjust();
const bool bLabelAlignmentPosAndSpaceModeActive(