sw/source/filter/ww8/ww8scan.cxx |   25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

New commits:
commit 7ddb7d30d44008f5873d20dbcd11a1afd46a3ec5
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sun Oct 11 16:10:11 2020 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Mon Oct 12 09:47:47 2020 +0200

    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 <[email protected]>

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;
 }
 
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to