summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/filter/ww8/ww8par.cxx13
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx8
-rw-r--r--sw/source/filter/ww8/ww8scan.hxx2
3 files changed, 11 insertions, 12 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 695620d2de2e..21791a99457f 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4651,15 +4651,14 @@ void SwWW8ImplReader::StoreMacroCmds()
{
uno::Reference < io::XStream > xStream =
xRoot->openStreamElement( OUString(SL::aMSMacroCmds), embed::ElementModes::READWRITE );
- SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( xStream );
+ std::unique_ptr<SvStream> xOutStream(::utl::UcbStreamHelper::CreateStream(xStream));
- sal_uInt8 *pBuffer = new sal_uInt8[m_pWwFib->lcbCmds];
- m_pWwFib->lcbCmds = m_pTableStream->Read(pBuffer, m_pWwFib->lcbCmds);
- pStream->Write(pBuffer, m_pWwFib->lcbCmds);
- delete[] pBuffer;
- delete pStream;
+ sal_uInt32 lcbCmds = std::min<sal_uInt32>(m_pWwFib->lcbCmds, m_pTableStream->remainingSize());
+ std::unique_ptr<sal_uInt8[]> xBuffer(new sal_uInt8[lcbCmds]);
+ m_pWwFib->lcbCmds = m_pTableStream->Read(xBuffer.get(), lcbCmds);
+ xOutStream->Write(xBuffer.get(), m_pWwFib->lcbCmds);
}
- catch ( const uno::Exception& )
+ catch (...)
{
}
}
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index a34dc30a45a4..bb5552a0aeea 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -5172,14 +5172,14 @@ namespace
{
if (eVer <= ww::eWW2)
{
- sal_uInt16 nShort;
- rSt.ReadUInt16( nShort );
+ sal_uInt16 nShort(0);
+ rSt.ReadUInt16(nShort);
return nShort;
}
else
{
- sal_uInt32 nLong;
- rSt.ReadUInt32( nLong );
+ sal_uInt32 nLong(0);
+ rSt.ReadUInt32(nLong);
return nLong;
}
}
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 4be181b81694..53e5d47c507b 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -1265,7 +1265,7 @@ public:
sal_Int32 lcbPlcfbkl; // 0x114 sal_Int32
WW8_FC fcCmds; // 0x118 FC
- sal_Int32 lcbCmds; // 0x11c
+ sal_uInt32 lcbCmds; // 0x11c
WW8_FC fcPlcfmcr; // 0x120 FC
sal_Int32 lcbPlcfmcr; // 0x124