unotools/source/ucbhelper/tempfile.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3076912419ddea4e1910a26e7c024cef4405dc5c
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Sep 14 12:27:19 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Sep 14 16:30:19 2022 +0200

    crashtesting: SvMemoryStream::PutData assert
    
    crashtesting logs contain a pile of SvMemoryStream::PutData assert
    failures with the last ~90 documents
    
    some experimentation suggests that the fallback path in
    TempFile::GetStream is getting taken to use a SvMemoryStream
    if there was no filename.
    
    presumably there is no filename because there is no inodes left
    in /tmp (see. https://gerrit.libreoffice.org/c/core/+/139881 to
    remove left over OSL_PIPE when killed) or some other similar problem.
    
    But the SvMemoryStream ctor used gives a Stream which cannot be written
    to because it's given an empty buffer to use and isn't allowed to resize
    it.
    
    this went wrong at:
    
    commit 7f8f277b94704a289fbbd1b836e4e5d66311580d
    Date:   Wed Jan 7 09:28:42 2015 +0200
    
        fdo#84938: convert STREAM_ #defines to 'enum class'
    
    with
    
    - pStream = new SvMemoryStream( eMode );
    + pStream = new SvMemoryStream( NULL, 0, eMode );
    
    which selected ctor
    a) SvMemoryStream(void* pBuf, std::size_t nSize, StreamMode eMode);
    Previously eMode was just a sal_uInt16 typedef and this gave a fairly
    arbitrary but useable nInitSize to select the other ctor of
    b) SvMemoryStream(std::size_t nInitSize=512, std::size_t nResize=64);
    
    Using eMode as nInitSize was bogus and worked by chance, that was
    introduced with:
    
    commit 160f790791d6e839919f0d0f9277cb047fe020ae
    Date:   Mon Oct 4 19:30:08 2004 +0000
    
        INTEGRATION: CWS mav09 (1.14.114); FILE MERGED
        2004/07/08 08:29:38 mav 1.14.114.3: RESYNC: (1.15-1.17); FILE MERGED
        2004/04/29 16:50:04 mav 1.14.114.2: RESYNC: (1.14-1.15); FILE MERGED
        2004/04/29 11:03:41 mba 1.14.114.1: #i27773#: no SvFileStream please
    
    Change-Id: I23ca3e8033400f6b016a802037dad3443df8af34
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139926
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/unotools/source/ucbhelper/tempfile.cxx 
b/unotools/source/ucbhelper/tempfile.cxx
index 83a523a2bd9b..faca685d2676 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -429,7 +429,7 @@ SvStream* TempFile::GetStream( StreamMode eMode )
         if (!aName.isEmpty())
             pStream.reset(new SvFileStream(aName, eMode | 
StreamMode::TEMPORARY));
         else
-            pStream.reset(new SvMemoryStream(nullptr, 0, eMode));
+            pStream.reset(new SvMemoryStream);
     }
 
     return pStream.get();

Reply via email to