[Libreoffice-commits] core.git: package/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 30 15:55:07 UTC 2021


 package/source/zipapi/XBufferedThreadedStream.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4bf1fbc9572741c665ae200303e929d908896820
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jul 30 11:48:45 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 30 17:54:32 2021 +0200

    tsan:data race in XBufferedThreadedStream
    
    cannot read from maInUseBuffer without holding the lock
    
    Change-Id: I4244e1132595a18c1a7ab33803e10b6c29684bf9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119707
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/package/source/zipapi/XBufferedThreadedStream.cxx b/package/source/zipapi/XBufferedThreadedStream.cxx
index ceb5f6895ba1..c36a1845be6c 100644
--- a/package/source/zipapi/XBufferedThreadedStream.cxx
+++ b/package/source/zipapi/XBufferedThreadedStream.cxx
@@ -93,10 +93,10 @@ void XBufferedThreadedStream::produce()
  */
 const Buffer& XBufferedThreadedStream::getNextBlock()
 {
+    std::unique_lock<std::mutex> aGuard( maBufferProtector );
     const sal_Int32 nBufSize = maInUseBuffer.getLength();
     if( nBufSize <= 0 || mnOffset >= nBufSize )
     {
-        std::unique_lock<std::mutex> aGuard( maBufferProtector );
         if( mnOffset >= nBufSize )
             maUsedBuffers.push( maInUseBuffer );
 


More information about the Libreoffice-commits mailing list