Kaydet (Commit) 1c349320 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#736207: Out-of-bounds access

Change-Id: I0867ff9dd279f06c4af0acc4e28f95b1f47dbe6b
üst 8ca9e356
......@@ -500,6 +500,17 @@ namespace sw
return aRet;
}
const SwNumFmt* GetNumFmtFromSwNumRuleLevel(const SwNumRule &rRule,
int nLevel)
{
if (nLevel < 0 || nLevel >= MAXLEVEL)
{
OSL_FAIL("Invalid level");
return NULL;
}
return &(rRule.Get( static_cast< sal_uInt16 >(nLevel) ));
}
const SwNumFmt* GetNumFmtFromTxtNode(const SwTxtNode &rTxtNode)
{
const SwNumRule *pRule = 0;
......@@ -508,7 +519,8 @@ namespace sw
0 != (pRule = rTxtNode.GetNumRule())
)
{
return &(pRule->Get( static_cast< sal_uInt16 >(rTxtNode.GetActualListLevel()) ));
return GetNumFmtFromSwNumRuleLevel(*pRule,
rTxtNode.GetActualListLevel());
}
OSL_ENSURE(rTxtNode.GetDoc(), "No document for node?, suspicious");
......@@ -520,7 +532,8 @@ namespace sw
0 != (pRule = rTxtNode.GetDoc()->GetOutlineNumRule())
)
{
return &(pRule->Get( static_cast< sal_uInt16 >(rTxtNode.GetActualListLevel()) ));
return GetNumFmtFromSwNumRuleLevel(*pRule,
rTxtNode.GetActualListLevel());
}
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment