diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-12-31 13:58:06 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-12-31 13:59:10 +0000 |
commit | 37f4239e511cb6b4cc6f1c2e76617acd13c8980a (patch) | |
tree | c977c325b846cf1a17cf2d2c48252a5a0fb54e28 /starmath/source | |
parent | 2ed6eba4f99681fe717741ddc1534ed3ccc15e82 (diff) |
ofz#4845 avoid oom
Change-Id: I816e2a2e2c21bf999c261e59c860fd142ba59f76
Diffstat (limited to 'starmath/source')
-rw-r--r-- | starmath/source/mathmlimport.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index 0caa425e8cba..336c926bd62a 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -2675,6 +2675,10 @@ void SmXMLTableContext_Impl::EndElement() nCols = std::max(nCols, pArray->GetNumSubNodes()); aReverseStack.push_front(std::unique_ptr<SmNode>(pArray)); } + if (nCols > SAL_MAX_UINT16) + throw std::range_error("column limit"); + if (nRows > SAL_MAX_UINT16) + throw std::range_error("row limit"); aExpressionArray.resize(nCols*nRows); size_t j=0; while ( !aReverseStack.empty() ) @@ -2691,7 +2695,7 @@ void SmXMLTableContext_Impl::EndElement() aToken.eType = TMATRIX; std::unique_ptr<SmMatrixNode> pSNode(new SmMatrixNode(aToken)); pSNode->SetSubNodes(aExpressionArray); - pSNode->SetRowCol(static_cast<sal_uInt16>(nRows),nCols); + pSNode->SetRowCol(nRows, nCols); rNodeStack.push_front(std::move(pSNode)); } |