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

coverity#1000600 Division or modulo by zero

Change-Id: I38fb8a7072eb7905f5dccc8697b3176d8b34c6c2
üst 1f6aefcf
...@@ -787,13 +787,20 @@ void DomainMapperTableManager::endOfRowAction() ...@@ -787,13 +787,20 @@ void DomainMapperTableManager::endOfRowAction()
for (sal_uInt32 i = 0; i < pCellWidths->size(); ++i) for (sal_uInt32 i = 0; i < pCellWidths->size(); ++i)
nFullWidthRelative += (*pCellWidths.get())[i]; nFullWidthRelative += (*pCellWidths.get())[i];
for (sal_uInt32 i = 0; i < pCellWidths->size() - 1; ++i) size_t nWidthsBound = pCellWidths->size() - 1;
if (nWidthsBound)
{
if (nFullWidthRelative == 0)
throw std::range_error("divide by zero");
for (sal_uInt32 i = 0; i < nWidthsBound; ++i)
{ {
nSum += (*pCellWidths.get())[i]; nSum += (*pCellWidths.get())[i];
pSeparators[nPos].Position = (nSum * 10000) / nFullWidthRelative; // Relative position pSeparators[nPos].Position = (nSum * 10000) / nFullWidthRelative; // Relative position
pSeparators[nPos].IsVisible = sal_True; pSeparators[nPos].IsVisible = sal_True;
nPos++; nPos++;
} }
}
TablePropertyMapPtr pPropMap( new TablePropertyMap ); TablePropertyMapPtr pPropMap( new TablePropertyMap );
pPropMap->Insert( PROP_TABLE_COLUMN_SEPARATORS, uno::makeAny( aSeparators ) ); pPropMap->Insert( PROP_TABLE_COLUMN_SEPARATORS, uno::makeAny( aSeparators ) );
......
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