summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-09-14 14:30:08 +0200
committerAndras Timar <andras.timar@collabora.com>2017-09-18 17:50:29 +0200
commitd40fbcce428534f7777a57c05478f27cebab0c3f (patch)
tree3da280d86d6473ec65947c4e7da0ed02913ae1a2 /sc
parentce2712be6e755c50fb611430bc5899a9a80552dd (diff)
ofz#3362 SYLK import: check ;X;Y;C;R col/row validity early
Change-Id: I37d5ce67f975b6b89c4b8a9baefae2467da2eb84 (cherry picked from commit 34ac0f9a0376b43bcff78a49ccaf4caa34c8c990) Reviewed-on: https://gerrit.libreoffice.org/42278 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit c759f30a5220dfd29894e34ee16c3fe2bf415592)
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/docshell/impex.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 0f0db15d30dc..7aa39d385a9c 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1776,15 +1776,35 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm )
{
case 'X':
nCol = static_cast<SCCOL>(OUString(p).toInt32()) + nStartCol - 1;
+ if (nCol < 0 || MAXCOL < nCol)
+ {
+ SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - ;X invalid nCol=" << nCol);
+ nCol = std::max<SCCOL>( 0, std::min<SCCOL>( nCol, MAXCOL));
+ }
break;
case 'Y':
nRow = OUString(p).toInt32() + nStartRow - 1;
+ if (nRow < 0 || MAXROW < nRow)
+ {
+ SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - ;Y invalid nRow=" << nRow);
+ nRow = std::max<SCROW>( 0, std::min<SCROW>( nRow, MAXROW));
+ }
break;
case 'C':
nRefCol = static_cast<SCCOL>(OUString(p).toInt32()) + nStartCol - 1;
+ if (nRefCol < 0 || MAXCOL < nRefCol)
+ {
+ SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - ;C invalid nRefCol=" << nRefCol);
+ nRefCol = std::max<SCCOL>( 0, std::min<SCCOL>( nRefCol, MAXCOL));
+ }
break;
case 'R':
nRefRow = OUString(p).toInt32() + nStartRow - 1;
+ if (nRefRow < 0 || MAXROW < nRefRow)
+ {
+ SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - ;R invalid nRefRow=" << nRefRow);
+ nRefRow = std::max<SCROW>( 0, std::min<SCROW>( nRefRow, MAXROW));
+ }
break;
case 'K':
{