summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-10-11 16:10:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-10-12 09:47:47 +0200
commit7ddb7d30d44008f5873d20dbcd11a1afd46a3ec5 (patch)
treed4ea4750e532e87bbc4308d7849231126082904f
parentf7e5b8e289645f2561844c0018bc4283b0e63b21 (diff)
ofz#23602 Timeout processing huge SEPX full of non-SEP properties
Change-Id: If95bf624e4bd18368f41b350fc3675e2675576c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104190 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx25
1 files changed, 14 insertions, 11 deletions
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 09b43d02f52f..bc7275ea3d6b 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -5191,22 +5191,25 @@ bool WW8PLCFMan::IsSprmLegalForCategory(sal_uInt16 nSprmId, short nIdx) const
bool bRet;
ww::WordVersion eVersion = maSprmParser.GetFIBVersion();
if (eVersion <= ww::eWW2)
- {
bRet = nSprmId >= 112 && nSprmId <= 145;
- SAL_WARN_IF(!bRet, "sw.ww8", "sprm, id " << nSprmId << " wrong category for section properties");
- assert(bRet && "once off crashtesting scan for real world cases");
- }
- else if (eVersion < ww::eWW8) // just check ww6/7 for now
- {
+ else if (eVersion < ww::eWW8)
bRet = nSprmId >= NS_sprm::v6::sprmSScnsPgn && nSprmId <= NS_sprm::v6::sprmSDMPaperReq;
- SAL_WARN_IF(!bRet, "sw.ww8", "sprm, id " << nSprmId << " wrong category for section properties");
- }
else
{
- // we could pull the sgc from the SprmId in this case
- bRet = true;
+ /*
+ Sprm bits: 10-12 sgc sprm group; type of sprm (PAP, CHP, etc)
+
+ sgc value type of sprm
+ 1 PAP
+ 2 CHP
+ 3 PIC
+ 4 SEP
+ 5 TAP
+ */
+ auto nSGC = ((nSprmId & 0x1C00) >> 10);
+ bRet = nSGC == 4;
}
-
+ SAL_WARN_IF(!bRet, "sw.ww8", "sprm, id " << nSprmId << " wrong category for section properties");
return bRet;
}