sc/source/core/tool/interpr1.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 862544b8bdc6b3e6b0b377a7e5271f3ad19ff9af
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Apr 9 17:24:31 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Apr 9 20:55:28 2025 +0200

    ofz: Use-of-uninitialized-value
    
    ==401==WARNING: MemorySanitizer: use-of-uninitialized-value
        #0 0x57a9d414370c in ScInterpreter::ScOr() 
/src/libreoffice/sc/source/core/tool/interpr1.cxx:1461:9
    
    Uninitialized value was created by an allocation of 'fVal' in the stack 
frame
        #0 0x57a9d4142e74 in ScInterpreter::ScOr() 
/src/libreoffice/sc/source/core/tool/interpr1.cxx:1414:25
    
    ScValueIterator::GetThis can call ScFormulaCell::GetErrorOrValue
    
    and both follow a pattern of returning true if an error is found,
    leaving the fValue argument uninitialized.
    
    Fix this the same way as the very similar:
    
    commit 7f8b4e14d787ec648a3de69fd51dc90fcfc876d9
    CommitDate: Sun Feb 9 14:16:42 2014 +0100
    
        fix memcheck report about uninitialized fVal
    
    Change-Id: I638791972aa605b4472ec63f7cd89c1f7a8636c4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183947
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 0b193b8708f0..ee742ab386ef 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -1414,7 +1414,7 @@ void ScInterpreter::ScOr()
                         double fVal;
                         FormulaError nErr = FormulaError::NONE;
                         ScValueIterator aValIter( mrContext, aRange );
-                        if ( aValIter.GetFirst( fVal, nErr ) )
+                        if ( aValIter.GetFirst( fVal, nErr ) && nErr == 
FormulaError::NONE )
                         {
                             bHaveValue = true;
                             do

Reply via email to