readonly SvMemoryStream shouldn't allow resize
Change-Id: I4cd1969cc961d48f904460371ab0a0f960bdea1e Reviewed-on: https://gerrit.libreoffice.org/34832 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
@@ -1830,7 +1830,7 @@ bool SvMemoryStream::AllocateMemory( std::size_t nNewSize )
|
|||||||
// (using Bozo algorithm)
|
// (using Bozo algorithm)
|
||||||
bool SvMemoryStream::ReAllocateMemory( long nDiff )
|
bool SvMemoryStream::ReAllocateMemory( long nDiff )
|
||||||
{
|
{
|
||||||
if (!bOwnsData)
|
if (!m_isWritable || !bOwnsData)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool bRetVal = false;
|
bool bRetVal = false;
|
||||||
@@ -1916,6 +1916,12 @@ void* SvMemoryStream::SwitchBuffer()
|
|||||||
|
|
||||||
void SvMemoryStream::SetSize(sal_uInt64 const nNewSize)
|
void SvMemoryStream::SetSize(sal_uInt64 const nNewSize)
|
||||||
{
|
{
|
||||||
|
if (!m_isWritable)
|
||||||
|
{
|
||||||
|
SetError(SVSTREAM_INVALID_HANDLE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
long nDiff = (long)nNewSize - (long)nSize;
|
long nDiff = (long)nNewSize - (long)nSize;
|
||||||
ReAllocateMemory( nDiff );
|
ReAllocateMemory( nDiff );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user