diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2016-11-04 21:14:34 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2016-11-11 15:41:24 +0000 |
commit | b8fa4d1b2d135cabc9eb5162ca0c5af649f1cdaf (patch) | |
tree | 1074297f9883314734c17983010a32de97eb45f2 /sc | |
parent | 7c0bc672791b9738aac94109ea530106c6a84682 (diff) |
tdf#103632 - sc: tolerate OOB sort fields from UNO API.
Change-Id: Ie04b4281947a05572672838b3b4b5c6173d8fa0b
Reviewed-on: https://gerrit.libreoffice.org/30576
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 49ac5e2bf1fb..a1084a6e0cad 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -5598,8 +5598,16 @@ void SAL_CALL ScCellRangeObj::sort( const uno::Sequence<beans::PropertyValue>& a SCCOLROW nFieldStart = aParam.bByRow ? static_cast<SCCOLROW>(aRange.aStart.Col()) : static_cast<SCCOLROW>(aRange.aStart.Row()); + SCCOLROW nFieldEnd = aParam.bByRow ? + static_cast<SCCOLROW>(aRange.aEnd.Col()) : + static_cast<SCCOLROW>(aRange.aEnd.Row()); for (i=0; i<aParam.GetSortKeyCount(); i++) + { aParam.maKeyState[i].nField += nFieldStart; + // tdf#103632 - sanity check poorly behaved macros. + if (aParam.maKeyState[i].nField > nFieldEnd) + aParam.maKeyState[i].nField = nFieldEnd; + } SCTAB nTab = aRange.aStart.Tab(); aParam.nCol1 = aRange.aStart.Col(); |