[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

Eike Rathke erack at redhat.com
Thu Sep 14 15:47:20 UTC 2017


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

New commits:
commit 29d72cac593d130e291aabb58685c0f6b7ffc59a
Author: Eike Rathke <erack at redhat.com>
Date:   Thu Sep 14 14:30:08 2017 +0200

    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/42277
    Tested-by: Jenkins <ci at libreoffice.org>
    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 70288a814c8b..f1e74326e3f0 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1753,15 +1753,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':
                         {


More information about the Libreoffice-commits mailing list