diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-09-18 15:40:16 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-09-19 22:50:18 +0200 |
commit | e67e1e73958c013371d89699a6512e96962d7f52 (patch) | |
tree | 54b411395235e439e87148c7825a3a61223a3404 /sc | |
parent | 8efd33127aff8d62bc2612ddc4bf97c1ef373338 (diff) |
ofz#3412 SYLK import: check ;X;Y;C;R col/row validity early
Change-Id: I91fcd2571e528201e01467f3bcdbbff30cdfb50c
Reviewed-on: https://gerrit.libreoffice.org/42426
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit 51854f5432de42bcc1154469edb5395328870613)
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 7aa39d385a9c..a65f985541e6 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1917,9 +1917,19 @@ 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 'P' : if ( bData ) |