summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-05-09 11:38:16 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-05-09 11:39:03 +0100
commitb43ad2e67550a3c085e080dead0c6fad970563f7 (patch)
tree4bfd2c67757961e63971aa161b51f14f46530693
parent4e63ff0dcb5c90ad5caf5ab91c3b9bc74e89bc7a (diff)
ofz avoid oom
Change-Id: I7d7e249a75fb33ac6a72e941f6b8f92ff8edf25a
-rw-r--r--sw/source/filter/ww8/ww8toolbar.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx
index 61208f586b79..33a4547ae6ba 100644
--- a/sw/source/filter/ww8/ww8toolbar.cxx
+++ b/sw/source/filter/ww8/ww8toolbar.cxx
@@ -1048,8 +1048,13 @@ bool PlfKme::Read(SvStream &rS)
nOffSet = rS.Tell();
Tcg255SubStruct::Read( rS );
rS.ReadInt32( iMac );
- if ( iMac )
+ if (iMac > 0)
{
+ //each Kme is 14 bytes in size
+ size_t nMaxAvailableRecords = rS.remainingSize() / 14;
+ if (static_cast<sal_uInt32>(iMac) > nMaxAvailableRecords)
+ return false;
+
rgkme.reset( new Kme[ iMac ] );
for( sal_Int32 index=0; index<iMac; ++index )
{