diff options
author | Eike Rathke <erack@redhat.com> | 2017-02-17 14:15:01 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-02-17 14:16:44 +0100 |
commit | 7fbdd8b7d3741d55b229977f9e6d6213af5fa542 (patch) | |
tree | c8d8da1845c80fef5c06533cd02d8d4ebe315c63 | |
parent | 9bdf971b0202c6d55d88e61861b251459de9586b (diff) |
more counts<SC_DPOUT_MAXLEVELS to check, tdf#105858 related
Also for row, column and page field arrays.
Change-Id: I1dccdf139af778a2c0dc550be0b573c984256a2d
-rw-r--r-- | sc/source/core/data/dpoutput.cxx | 107 |
1 files changed, 64 insertions, 43 deletions
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 18f57762392b..47aa7338c644 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -618,53 +618,74 @@ ScDPOutput::ScDPOutput( ScDocument* pD, const uno::Reference<sheet::XDimensionsS switch ( eDimOrient ) { case sheet::DataPilotFieldOrientation_COLUMN: - pColFields[nColFieldCount].nDim = nDim; - pColFields[nColFieldCount].nHier = nHierarchy; - pColFields[nColFieldCount].nLevel = nLev; - pColFields[nColFieldCount].nDimPos = nDimPos; - pColFields[nColFieldCount].aResult = xLevRes->getResults(); - pColFields[nColFieldCount].mnSrcNumFmt = nNumFmt; - pColFields[nColFieldCount].maName = aName; - pColFields[nColFieldCount].maCaption= aCaption; - pColFields[nColFieldCount].mfValue = fValue; - pColFields[nColFieldCount].mbHasHiddenMember = bHasHiddenMember; - pColFields[nColFieldCount].mbDataLayout = bIsDataLayout; - if (!lcl_MemberEmpty(pColFields[nColFieldCount].aResult)) - ++nColFieldCount; - break; + if (nColFieldCount < SC_DPOUT_MAXLEVELS) + { + pColFields[nColFieldCount].nDim = nDim; + pColFields[nColFieldCount].nHier = nHierarchy; + pColFields[nColFieldCount].nLevel = nLev; + pColFields[nColFieldCount].nDimPos = nDimPos; + pColFields[nColFieldCount].aResult = xLevRes->getResults(); + pColFields[nColFieldCount].mnSrcNumFmt = nNumFmt; + pColFields[nColFieldCount].maName = aName; + pColFields[nColFieldCount].maCaption= aCaption; + pColFields[nColFieldCount].mfValue = fValue; + pColFields[nColFieldCount].mbHasHiddenMember = bHasHiddenMember; + pColFields[nColFieldCount].mbDataLayout = bIsDataLayout; + if (!lcl_MemberEmpty(pColFields[nColFieldCount].aResult)) + ++nColFieldCount; + } + else + { + SAL_WARN("sc.core","ScDPOutput - nColFieldCount already at SC_DPOUT_MAXLEVELS=" << SC_DPOUT_MAXLEVELS); + } + break; case sheet::DataPilotFieldOrientation_ROW: - pRowFields[nRowFieldCount].nDim = nDim; - pRowFields[nRowFieldCount].nHier = nHierarchy; - pRowFields[nRowFieldCount].nLevel = nLev; - pRowFields[nRowFieldCount].nDimPos = nDimPos; - pRowFields[nRowFieldCount].aResult = xLevRes->getResults(); - pRowFields[nRowFieldCount].mnSrcNumFmt = nNumFmt; - pRowFields[nRowFieldCount].maName = aName; - pRowFields[nRowFieldCount].maCaption= aCaption; - pRowFields[nRowFieldCount].mfValue = fValue; - pRowFields[nRowFieldCount].mbHasHiddenMember = bHasHiddenMember; - pRowFields[nRowFieldCount].mbDataLayout = bIsDataLayout; - if (!lcl_MemberEmpty(pRowFields[nRowFieldCount].aResult)) + if (nRowFieldCount < SC_DPOUT_MAXLEVELS) + { + pRowFields[nRowFieldCount].nDim = nDim; + pRowFields[nRowFieldCount].nHier = nHierarchy; + pRowFields[nRowFieldCount].nLevel = nLev; + pRowFields[nRowFieldCount].nDimPos = nDimPos; + pRowFields[nRowFieldCount].aResult = xLevRes->getResults(); + pRowFields[nRowFieldCount].mnSrcNumFmt = nNumFmt; + pRowFields[nRowFieldCount].maName = aName; + pRowFields[nRowFieldCount].maCaption= aCaption; + pRowFields[nRowFieldCount].mfValue = fValue; + pRowFields[nRowFieldCount].mbHasHiddenMember = bHasHiddenMember; + pRowFields[nRowFieldCount].mbDataLayout = bIsDataLayout; + if (!lcl_MemberEmpty(pRowFields[nRowFieldCount].aResult)) + { + ++nRowFieldCount; + bRowFieldHasMember = true; + } + } + else { - ++nRowFieldCount; - bRowFieldHasMember = true; + SAL_WARN("sc.core","ScDPOutput - nRowFieldCount already at SC_DPOUT_MAXLEVELS=" << SC_DPOUT_MAXLEVELS); } - break; + break; case sheet::DataPilotFieldOrientation_PAGE: - pPageFields[nPageFieldCount].nDim = nDim; - pPageFields[nPageFieldCount].nHier = nHierarchy; - pPageFields[nPageFieldCount].nLevel = nLev; - pPageFields[nPageFieldCount].nDimPos = nDimPos; - pPageFields[nPageFieldCount].aResult = getVisiblePageMembersAsResults(xLevel); - pPageFields[nPageFieldCount].mnSrcNumFmt = nNumFmt; - pPageFields[nPageFieldCount].maName = aName; - pPageFields[nPageFieldCount].maCaption= aCaption; - pPageFields[nPageFieldCount].mfValue = fValue; - pPageFields[nPageFieldCount].mbHasHiddenMember = bHasHiddenMember; - pPageFields[nPageFieldCount].mbPageDim = true; - // no check on results for page fields - ++nPageFieldCount; - break; + if (nPageFieldCount < SC_DPOUT_MAXLEVELS) + { + pPageFields[nPageFieldCount].nDim = nDim; + pPageFields[nPageFieldCount].nHier = nHierarchy; + pPageFields[nPageFieldCount].nLevel = nLev; + pPageFields[nPageFieldCount].nDimPos = nDimPos; + pPageFields[nPageFieldCount].aResult = getVisiblePageMembersAsResults(xLevel); + pPageFields[nPageFieldCount].mnSrcNumFmt = nNumFmt; + pPageFields[nPageFieldCount].maName = aName; + pPageFields[nPageFieldCount].maCaption= aCaption; + pPageFields[nPageFieldCount].mfValue = fValue; + pPageFields[nPageFieldCount].mbHasHiddenMember = bHasHiddenMember; + pPageFields[nPageFieldCount].mbPageDim = true; + // no check on results for page fields + ++nPageFieldCount; + } + else + { + SAL_WARN("sc.core","ScDPOutput - nPageFieldCount already at SC_DPOUT_MAXLEVELS=" << SC_DPOUT_MAXLEVELS); + } + break; default: { // added to avoid warnings |