[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sc/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 9 15:31:35 UTC 2019


 sc/source/filter/excel/xepivotxml.cxx |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 5608074fa6cb1ebfbe8de5189bbe8d74606d088a
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Wed Aug 7 16:03:34 2019 +0300
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Aug 9 17:30:29 2019 +0200

    tdf#126748: temporary hack to avoid crash when several pivot tables ...
    
    ... reference a single cache, and have different sets of group fields.
    
    The problem is getting group field names from the tables referencing
    the cache; so when a table referencing not all group fields happens
    to be first in the reference list, the returned name is empty.
    
    The hack just stops writing group fields as soon as it finds an empty
    name; this naturally leaves bad cache data behind, but at least doen't
    crash. The retrieval of the names should be reimplemented using a
    different source, to not depend on tables referencing the cache.
    
    Regression after commit b082998401e37e6c7534906601bc481423a6ded0.
    
    Change-Id: Ib2e92f8acf93a801861c6ba5c68fab3bebe3672c
    Reviewed-on: https://gerrit.libreoffice.org/77110
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit f5c27036ad63c8bc3d9b86f2e4e772c01490d883)
    Reviewed-on: https://gerrit.libreoffice.org/77124
    Tested-by: Xisco Faulí <xiscofauli at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx
index 3143f3b1b04a..57abfd60b3b7 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -511,6 +511,16 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr
     for (size_t i = nCount; pDPObject && i < nCount + nGroupFieldCount; ++i)
     {
         const OUString aName = pDPObject->GetDimName(i, o3tl::temporary(bool()));
+        // tdf#126748: DPObject might not reference all group fields, when there are several
+        // DPObjects referencing this cache. Trying to get a dimension data for a field not used
+        // in a given DPObject will give nullptr, and dereferencing it then will crash. To avoid
+        // the crash, until there's a correct method to find the names of group fields in cache,
+        // just skip the fields, creating bad cache data, which is of course a temporary hack.
+        // TODO: reimplement the whole block to get the names from another source, not from first
+        // cache reference.
+        if (aName.isEmpty())
+            break;
+
         ScDPSaveData* pSaveData = pDPObject->GetSaveData();
         assert(pSaveData);
         const ScDPSaveGroupDimension* pDim = pSaveData->GetDimensionData()->GetNamedGroupDim(aName);


More information about the Libreoffice-commits mailing list