[Libreoffice-commits] core.git: sc/source

Caolán McNamara caolanm at redhat.com
Mon Sep 18 15:12:18 UTC 2017


 sc/source/ui/docshell/impex.cxx |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 227d9d3fe598c089aee4421f0ad503acb85f3c4c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Sep 18 15:40:16 2017 +0100

    ofz#3412 SYLK import: check ;X;Y;C;R col/row validity early
    
    Change-Id: I91fcd2571e528201e01467f3bcdbbff30cdfb50c
    Reviewed-on: https://gerrit.libreoffice.org/42423
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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<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 )


More information about the Libreoffice-commits mailing list