diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-03-15 16:44:59 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-03-15 16:44:59 +0000 |
commit | 89b87c04469d716cdf90bc422c5e829178a9fe32 (patch) | |
tree | 7711ad0a0d1522c484b3933f18d9080e18e68a54 /lotuswordpro | |
parent | 89628e4814b96b6d1bce768ca9b45eb665871d11 (diff) |
ofz: avoid oom
Change-Id: Ia4b9c46949017a53c80f729af66b99c2e4f05cee
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/source/filter/lwpgrfobj.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx index cf5cc9953e88..ddb79592c566 100644 --- a/lotuswordpro/source/filter/lwpgrfobj.cxx +++ b/lotuswordpro/source/filter/lwpgrfobj.cxx @@ -160,6 +160,14 @@ void LwpGraphicObject::Read() sal_uInt32 nFilterContextSize = m_pObjStrm->QuickReaduInt32(); if (nFilterContextSize > 0) { + sal_uInt16 nMaxPossibleSize = m_pObjStrm->remainingSize(); + + if (nFilterContextSize > nMaxPossibleSize) + { + SAL_WARN("lwp", "stream too short for claimed no of records"); + nFilterContextSize = nMaxPossibleSize; + } + pFilterContext = new unsigned char[nFilterContextSize]; m_pObjStrm->QuickRead(pFilterContext, static_cast<sal_uInt16>(nFilterContextSize)); } |