[Libreoffice-commits] core.git: 2 commits - lotuswordpro/source sfx2/source
Caolán McNamara
caolanm at redhat.com
Fri Mar 10 10:23:18 UTC 2017
lotuswordpro/source/filter/lwpgrfobj.cxx | 8 ++++++++
lotuswordpro/source/filter/lwpobjstrm.cxx | 6 ++++++
lotuswordpro/source/filter/lwpobjstrm.hxx | 1 +
sfx2/source/control/request.cxx | 8 ++++----
4 files changed, 19 insertions(+), 4 deletions(-)
New commits:
commit 1353ebe535732022aef4377030d86ad7153c3144
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Mar 10 10:21:41 2017 +0000
ofz#801 avoid oom
Change-Id: Id3167d1eb3f058543ab7596008012d51b3d242b7
diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index 04d4616..cf5cc995 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -113,6 +113,14 @@ void LwpGraphicObject::Read()
unsigned char *pServerContext = nullptr;
if (nServerContextSize > 0)
{
+ sal_uInt16 nMaxPossibleSize = m_pObjStrm->remainingSize();
+
+ if (nServerContextSize > nMaxPossibleSize)
+ {
+ SAL_WARN("lwp", "stream too short for claimed no of records");
+ nServerContextSize = nMaxPossibleSize;
+ }
+
pServerContext = new unsigned char[nServerContextSize];
m_pObjStrm->QuickRead(pServerContext, static_cast<sal_uInt16>(nServerContextSize));
if (nServerContextSize > 44)
diff --git a/lotuswordpro/source/filter/lwpobjstrm.cxx b/lotuswordpro/source/filter/lwpobjstrm.cxx
index 8a28c9f..072edf7 100644
--- a/lotuswordpro/source/filter/lwpobjstrm.cxx
+++ b/lotuswordpro/source/filter/lwpobjstrm.cxx
@@ -155,6 +155,12 @@ void LwpObjectStream::ReleaseBuffer()
}
}
}
+
+sal_uInt16 LwpObjectStream::remainingSize() const
+{
+ return m_nBufSize - m_nReadPos;
+}
+
/**
* @descr read len bytes from object stream to buffer
*/
diff --git a/lotuswordpro/source/filter/lwpobjstrm.hxx b/lotuswordpro/source/filter/lwpobjstrm.hxx
index 918659d..83062ee 100644
--- a/lotuswordpro/source/filter/lwpobjstrm.hxx
+++ b/lotuswordpro/source/filter/lwpobjstrm.hxx
@@ -85,6 +85,7 @@ private:
LwpSvStream* m_pStrm;
bool m_bCompressed;
public:
+ sal_uInt16 remainingSize() const;
sal_uInt16 QuickRead(void* buf, sal_uInt16 len);
sal_uInt16 GetPos() { return m_nReadPos; }
void SeekRel(sal_uInt16 pos);
commit c299011abeb50a9fccb420d6b1e8e82924efc329
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Mar 10 09:07:17 2017 +0000
shuffle this around a little
Change-Id: Ibf23114885c49163d50b3249db8788770fe74352
diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx
index a7785cf..489d9f3 100644
--- a/sfx2/source/control/request.cxx
+++ b/sfx2/source/control/request.cxx
@@ -69,6 +69,7 @@ struct SfxRequest_Impl: public SfxListener
SfxViewFrame* pViewFrame;
css::uno::Reference< css::frame::XDispatchRecorder > xRecorder;
+ css::uno::Reference< uno::XComponentContext > xContext;
explicit SfxRequest_Impl( SfxRequest *pOwner )
: pAnti( pOwner)
@@ -83,8 +84,9 @@ struct SfxRequest_Impl: public SfxListener
, nCallMode( SfxCallMode::SYNCHRON )
, bAllowRecording( false )
, pViewFrame(nullptr)
- {}
-
+ , xContext(comphelper::getProcessComponentContext())
+ {
+ }
void SetPool( SfxItemPool *pNewPool );
virtual void Notify( SfxBroadcaster &rBC, const SfxHint &rHint ) override;
@@ -349,8 +351,6 @@ void SfxRequest_Impl::Record
}
}
- uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
-
uno::Reference< util::XURLTransformer > xTransform = util::URLTransformer::create( xContext );
css::util::URL aURL;
More information about the Libreoffice-commits
mailing list