summaryrefslogtreecommitdiff
path: root/lotuswordpro/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-09 11:28:52 +0000
committerMichael Meeks <michael.meeks@collabora.com>2015-12-10 09:36:47 +0000
commit7097ee0c9e54b3d1303b4cb5d8aff2cf509e466b (patch)
tree97beb3a7d9b347f9b809455557115a72f1e87d2f /lotuswordpro/source
parentec2b10a8f47a92971464dfa741392d5410ffb2f8 (diff)
guard against corrupt RootData
Change-Id: Iad2788a7e5e7ee3b3107eab37cde2d3d38eae005 (cherry picked from commit fc943ea85a7924ce0552b08eef99ed8e02f0b965) Reviewed-on: https://gerrit.libreoffice.org/20497 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'lotuswordpro/source')
-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 07ea4a1a521f..d6720e706e06 100644
--- a/lotuswordpro/source/filter/lwpidxmgr.cxx
+++ b/lotuswordpro/source/filter/lwpidxmgr.cxx
@@ -154,7 +154,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 82957961895b..f3c86d05460f 100644
--- a/lotuswordpro/source/filter/lwptabrack.cxx
+++ b/lotuswordpro/source/filter/lwptabrack.cxx
@@ -90,7 +90,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);