summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-09-21 12:28:48 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-09-21 12:28:48 +0100
commitfe9cce9453ca0e1aac77834af8160f0d11887a55 (patch)
treedb17657e72eb7fd2b86e0c00f5aeeaa9b574f5ac
parent74441e736edfd20621af71de22b2e92cbc4f7f3c (diff)
CID#1000697 out of bounds access
Change-Id: I59f80463aa13e3c28695112165343f93366cfec4
-rw-r--r--sw/source/core/doc/docfmt.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index a9d9f04fa3d5..7d4a8094f6b0 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -585,7 +585,15 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
return false;
}
- SwNumFmt aNumFmt = pNumRule->Get(static_cast<sal_uInt16>(pTxtNd->GetActualListLevel()));
+ int nLevel = pTxtNd->GetActualListLevel();
+
+ if (nLevel < 0)
+ nLevel = 0;
+
+ if (nLevel >= MAXLEVEL)
+ nLevel = MAXLEVEL - 1;
+
+ SwNumFmt aNumFmt = pNumRule->Get(static_cast<sal_uInt16>(nLevel));
SwCharFmt * pCharFmt =
pDoc->FindCharFmtByName(aNumFmt.GetCharFmtName());