vcl/source/helper/strhelper.cxx |    1 +
 1 file changed, 1 insertion(+)

New commits:
commit 7ae3fbe10811443050068627d0fdde66c551cd13
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Mon May 2 15:01:17 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Mon May 2 20:01:38 2022 +0200

    Silence -Werror=maybe-uninitialized
    
    > vcl/source/helper/strhelper.cxx: In function ‘rtl::OString 
psp::WhitespaceToSpace(std::string_view)’:
    > vcl/source/helper/strhelper.cxx:365:9: error: ‘pBuffer[-1]’ may be used 
uninitialized [-Werror=maybe-uninitialized]
    >   365 |     if( *pLeap == ' ' )
    >       |         ^~~~~~
    
    that hits at least with GCC 13 trunk now (and which actually is a false 
positive
    as far as I can tell)
    
    Change-Id: I69b96e4cf68f0ed20ac7d73014c164db792983a6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133704
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx
index 3413d454d131..e44ba8530542 100644
--- a/vcl/source/helper/strhelper.cxx
+++ b/vcl/source/helper/strhelper.cxx
@@ -361,6 +361,7 @@ OString WhitespaceToSpace(std::string_view rLine)
     *pLeap = 0;
 
     // there might be a space at beginning or end
+    assert(pLeap > pBuffer);
     pLeap--;
     if( *pLeap == ' ' )
         *pLeap = 0;

Reply via email to