From 227d9d3fe598c089aee4421f0ad503acb85f3c4c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 18 Sep 2017 15:40:16 +0100 Subject: ofz#3412 SYLK import: check ;X;Y;C;R col/row validity early MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I91fcd2571e528201e01467f3bcdbbff30cdfb50c Reviewed-on: https://gerrit.libreoffice.org/42423 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sc/source/ui/docshell/impex.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sc') diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index cd92f13e0586..3fe47e3ef4ee 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1893,9 +1893,19 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) { case 'X': nCol = static_cast(OUString(p).toInt32()) + nStartCol - 1; + if (nCol < 0 || MAXCOL < nCol) + { + SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - ;X invalid nCol=" << nCol); + nCol = std::max( 0, std::min( 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( 0, std::min( nRow, MAXROW)); + } break; case 'P' : if ( bData ) -- cgit