[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - lotuswordpro/source
Caolán McNamara
caolanm at redhat.com
Wed Dec 9 03:38:22 PST 2015
lotuswordpro/source/filter/lwpidxmgr.cxx | 5 ++++-
lotuswordpro/source/filter/lwptabrack.cxx | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 77ffba5c0021272950e03d408535ea9cbc1dfebb
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Dec 9 11:28:52 2015 +0000
guard against corrupt RootData
Change-Id: Iad2788a7e5e7ee3b3107eab37cde2d3d38eae005
(cherry picked from commit fc943ea85a7924ce0552b08eef99ed8e02f0b965)
Reviewed-on: https://gerrit.libreoffice.org/20495
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/lotuswordpro/source/filter/lwpidxmgr.cxx b/lotuswordpro/source/filter/lwpidxmgr.cxx
index e58d053..2e675f3 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 9d284db..582b711 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);
More information about the Libreoffice-commits
mailing list