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

New commits:
commit e3545d491e2a2c4ff609a63385994f0c8d388edf
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Sep 3 11:51:41 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Sep 3 14:25:43 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 <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.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 1ab5a79aee30..c8645083c2ef 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;
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to