sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit be2cfec1f81129b29ba24c3ed6cf00ff66b12a6a
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Tue Sep 23 16:31:25 2025 +0200
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Wed Sep 24 07:58:07 2025 +0200

    This code apparently wants to use std::multimap::lower_bound
    
    ...(which returns the first element in the range of equivalent ones) rather 
than
    std::multimap::find (which returns a random element from the range of 
equivalent
    ones).  This e.g. caused SIGSEGV during CppunitTest_sw_filters_test when 
using a
    libc++ built with -DLIBCXX_HARDENING_MODE=debug (which does return a random
    element, rather than the first, from std::multimap::find), and the
    
    >                         ++aTOCStyleIter;
    
    a few lines further down could thus try to go beyond the end of aMap.
    
    Change-Id: I7646a41d203b458bccc451ee74c2840af3870255
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191406
    Reviewed-by: Stephan Bergmann <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 17aec3d4fcb2..88c2ad0ef422 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -7585,7 +7585,7 @@ void DomainMapper_Impl::handleToc
                 sal_Int32 nLevelCount = aMap.count( nLevel );
                 if( nLevelCount  )
                 {
-                    TOCStyleMap::iterator aTOCStyleIter = aMap.find( nLevel );
+                    TOCStyleMap::iterator aTOCStyleIter = aMap.lower_bound( 
nLevel );
 
                     uno::Sequence< OUString> aStyles( nLevelCount );
                     for ( auto& rStyle : asNonConstRange(aStyles) )

Reply via email to