summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-09 11:28:52 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-12-09 11:35:45 +0000
commitfc943ea85a7924ce0552b08eef99ed8e02f0b965 (patch)
tree095e25f20c2f814bb265373a47ebe9ac9dcb9eaa
parentff39b78d74cfb30e2b485818b217915fd9a31b92 (diff)
guard against corrupt RootData
Change-Id: Iad2788a7e5e7ee3b3107eab37cde2d3d38eae005
-rw-r--r--lotuswordpro/source/filter/lwpidxmgr.cxx5
-rw-r--r--lotuswordpro/source/filter/lwptabrack.cxx2
2 files changed, 5 insertions, 2 deletions
diff --git a/lotuswordpro/source/filter/lwpidxmgr.cxx b/lotuswordpro/source/filter/lwpidxmgr.cxx
index e58d0538716d..2e675f3bae7b 100644
--- a/lotuswordpro/source/filter/lwpidxmgr.cxx
+++ b/lotuswordpro/source/filter/lwpidxmgr.cxx
@@ -152,7 +152,10 @@ void LwpIndexManager::ReadRootData(LwpObjectStream* pObjStrm)
sal_uInt16 KeyCount = pObjStrm->QuickReaduInt16();
m_nLeafCount = KeyCount ? KeyCount + 1 : 0;
- if(KeyCount)
+ if (m_nLeafCount > SAL_N_ELEMENTS(m_ChildIndex))
+ throw std::range_error("corrupt RootData");
+
+ if (KeyCount)
{
//read object keys
LwpKey* akey = new LwpKey();
diff --git a/lotuswordpro/source/filter/lwptabrack.cxx b/lotuswordpro/source/filter/lwptabrack.cxx
index 9d284dbbcdee..582b7110336d 100644
--- a/lotuswordpro/source/filter/lwptabrack.cxx
+++ b/lotuswordpro/source/filter/lwptabrack.cxx
@@ -92,7 +92,7 @@ void LwpTabRack::Read()
m_nNumTabs = m_pObjStrm->QuickReaduInt16();
if (m_nNumTabs > MaxTabs)
- throw std::out_of_range("corrupt LwpTabRack");
+ throw std::range_error("corrupt LwpTabRack");
for (int i=0; i<m_nNumTabs; ++i)
{
m_aTabs[i].Read(m_pObjStrm);