[Libreoffice-commits] core.git: sc/qa sc/source

Caolán McNamara caolanm at redhat.com
Tue May 29 08:03:32 UTC 2018


 sc/qa/unit/data/xls/forcepoint-pivot-1.xls |binary
 sc/source/filter/excel/xipivot.cxx         |    8 ++++----
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 0162cfd55f397ded2af7d32f50cb3cba763c68bc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 28 21:22:56 2018 +0100

    forcepoint#40 null deref
    
    presumably since
    
    commit 0098bee792c3e208ea4f6ef1c676958d3f4cd207
    Date:   Thu Sep 21 06:48:09 2017 +0200
    
        tdf#112501: Pivot table: popupbuttons are placed on wrong cells
    
    Change-Id: I5413c0ba06fca25cb22256a20ef9640767dd9e50
    Reviewed-on: https://gerrit.libreoffice.org/54968
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/qa/unit/data/xls/forcepoint-pivot-1.xls b/sc/qa/unit/data/xls/forcepoint-pivot-1.xls
new file mode 100644
index 000000000000..12919922666b
Binary files /dev/null and b/sc/qa/unit/data/xls/forcepoint-pivot-1.xls differ
diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index 118e9a014691..b0452408054b 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -1566,13 +1566,13 @@ void XclImpPivotTable::ApplyMergeFlags(const ScRange& rOutRange, const ScDPSaveD
         itr    = aFieldBtns.begin();
         itrEnd = aFieldBtns.end();
         vector<const ScDPSaveDimension*>::const_iterator itDim = aFieldDims.begin();
-        for (; itr != itrEnd; ++itr, ++itDim)
+        for (; itr != itrEnd; ++itr)
         {
             ScMF nMFlag = ScMF::Button;
-            const ScDPSaveDimension* pDim = *itDim;
-            if (pDim->HasInvisibleMember())
+            const ScDPSaveDimension* pDim = itDim != aFieldDims.end() ? *itDim++ : nullptr;
+            if (pDim && pDim->HasInvisibleMember())
                 nMFlag |= ScMF::HiddenMember;
-            if (!pDim->IsDataLayout())
+            if (!pDim || !pDim->IsDataLayout())
                 nMFlag |= ScMF::ButtonPopup;
             rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), itr->Tab(), nMFlag);
         }


More information about the Libreoffice-commits mailing list