[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sc/qa sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 8 15:08:39 UTC 2020


 sc/qa/unit/functions_test.cxx    |    4 ----
 sc/source/core/tool/interpr8.cxx |    2 ++
 2 files changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 69b287731c1c4693ab9d2ed696e829a15f01071d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Sep 3 11:51:41 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Sep 8 17:08:02 2020 +0200

    intermittent forecast.ets.add.fods failure
    
    valgrinding the forecast.ets.add.fods failure gives...
    
    a) mnSmplInPrd is 9
    b) ScETSForecastCalculation::prefillPerIdx:476 fills mpPerIdx to index 8 with values.
    c) ScETSForecastCalculation::refill:791 (the bAdditive branch)
       due to nIdx = ( i > mnSmplInPrd ? i - mnSmplInPrd : i ) with i of 9 gives nIdx of 9 and
       uninit mpPerIdx[9] is used in the calculation.
    d) At line 799 (the !bAdditive branch)
       due to nIdx = ( i >= mnSmplInPrd ? i - mnSmplInPrd : i ) the nIdx used would be 0 not 9
       under the same circumstances
    
    extending the initialization of prefillPerIdx to zeroing out the next index gives the same
    results as we usually get and test passes without a need to change it while avoiding the use
    of an uninitialized value.
    
    Change-Id: Ib4629b28ecf2389c0c7611137b756d4d2d9fd700
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101997
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit e3545d491e2a2c4ff609a63385994f0c8d388edf)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101961
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sc/qa/unit/functions_test.cxx b/sc/qa/unit/functions_test.cxx
index 1a48c03432d9..16e0a530a5e5 100644
--- a/sc/qa/unit/functions_test.cxx
+++ b/sc/qa/unit/functions_test.cxx
@@ -40,10 +40,6 @@ bool FunctionsTest::load(const OUString& rFilter, const OUString& rURL,
 
     ScDocument& rDoc = xDocShRef->GetDocument();
 
-#ifdef __APPLE__
-// FIXME tends to fail a lot
-if (!rURL.endsWith("forecast.ets.add.fods"))
-#endif
     CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, rDoc.GetValue(1, 2, 0), 1e-14);
 
     xDocShRef->DoClose();
diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx
index 92ea9ab1ac11..d380a057176b 100644
--- a/sc/source/core/tool/interpr8.cxx
+++ b/sc/source/core/tool/interpr8.cxx
@@ -475,6 +475,8 @@ bool ScETSForecastCalculation::prefillPerIdx()
             }
             mpPerIdx[ j ] = fI / nPeriods;
         }
+        if (mnSmplInPrd < mnCount)
+            mpPerIdx[mnSmplInPrd] = 0.0;
     }
     return true;
 }


More information about the Libreoffice-commits mailing list