package/source/xstor/switchpersistencestream.cxx | 10 +++++++++- package/source/zipapi/ByteGrabber.cxx | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-)
New commits: commit 1ee8eb866bc7a4ae23107e76af97ac2ab4120e49 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Aug 15 11:44:08 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Aug 15 18:41:05 2025 +0200 tdf#167936 crash when opening document from UNO pipe (2) second attempt at this, the first commit did not catch all the places regression from commit a6ad198d097fb4a503c8d5831d484ff46721134b Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Sat Aug 17 13:19:54 2024 +0200 tdf#158556 use more comphelper::ByteReader Change-Id: If3ab68f7cf147082ec296d6679d48f15ec0fdcb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189669 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins (cherry picked from commit d0530c1627cab736cf4636b4983b7d2d1f6a8882) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189676 diff --git a/package/source/xstor/switchpersistencestream.cxx b/package/source/xstor/switchpersistencestream.cxx index 6613b8b046b1..8052ff9ecc63 100644 --- a/package/source/xstor/switchpersistencestream.cxx +++ b/package/source/xstor/switchpersistencestream.cxx @@ -256,7 +256,15 @@ uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOut if ( !m_pStreamData->m_xOrigInStream.is() ) throw uno::RuntimeException(); - return m_pStreamData->m_pByteReader->readSomeBytes( aData, nBytesToRead ); + if (m_pStreamData->m_pByteReader) + return m_pStreamData->m_pByteReader->readSomeBytes( aData, nBytesToRead ); + else + { + css::uno::Sequence < sal_Int8 > aSequence; + sal_Int32 nBytesActuallyRead = m_pStreamData->m_xOrigInStream->readSomeBytes( aSequence, nBytesToRead ); + memcpy(aData, aSequence.getConstArray(), nBytesActuallyRead); + return nBytesActuallyRead; + } } void SAL_CALL SwitchablePersistenceStream::skipBytes( ::sal_Int32 nBytesToSkip ) diff --git a/package/source/zipapi/ByteGrabber.cxx b/package/source/zipapi/ByteGrabber.cxx index bc1206986c5c..23b157423df8 100644 --- a/package/source/zipapi/ByteGrabber.cxx +++ b/package/source/zipapi/ByteGrabber.cxx @@ -60,7 +60,14 @@ void ByteGrabber::setInputStream (const uno::Reference < io::XInputStream >& xNe sal_Int32 ByteGrabber::readBytes( sal_Int8* aData, sal_Int32 nBytesToRead ) { - return mpByteReader->readSomeBytes(aData, nBytesToRead ); + if (mpByteReader) + return mpByteReader->readSomeBytes(aData, nBytesToRead ); + else + { + sal_Int32 nBytesActuallyRead = xStream->readSomeBytes(aSequence, nBytesToRead); + memcpy(aData, aSequence.getConstArray(), nBytesActuallyRead); + return nBytesActuallyRead; + } } // XSeekable chained...