summaryrefslogtreecommitdiffstats
path: root/vcl/source/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-04-02 11:52:06 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-04-02 11:52:06 +0100
commite9bd695a063e111cdc002b73a6a5cccbc52ef4d3 (patch)
tree1cb614be9592da95e33ff83711cf09a2de36e33e /vcl/source/filter
parentalign fftester and wmffuzzer (diff)
downloadcore-e9bd695a063e111cdc002b73a6a5cccbc52ef4d3.tar.gz
core-e9bd695a063e111cdc002b73a6a5cccbc52ef4d3.zip
ofz: avoid oom
Change-Id: Ibffae78a1186492300c237e85089702491cf4a0f
Diffstat (limited to 'vcl/source/filter')
-rw-r--r--vcl/source/filter/wmf/winwmf.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index 94783f8879d4..0ce2ff3eccac 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -1131,18 +1131,25 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
}
nEMFRec++;
- if( pEMFStream && nCurRecSize + 34 > nLen )
+ if (pEMFStream && nCurRecSize + 34 > nLen)
{
nEMFRecCount = 0xFFFFFFFF;
pEMFStream.reset();
}
- if( pEMFStream )
+ if (pEMFStream && nCurRecSize > pWMF->remainingSize())
{
- std::unique_ptr<sal_Int8[]> pBuf(new sal_Int8[ nCurRecSize ]);
- sal_uInt32 nCount = pWMF->ReadBytes(pBuf.get(), nCurRecSize);
+ SAL_WARN("vcl.wmf", "emf record size claims to be larger than remaining data");
+ nEMFRecCount = 0xFFFFFFFF;
+ pEMFStream.reset();
+ }
+
+ if (pEMFStream)
+ {
+ std::vector<sal_Int8> aBuf(nCurRecSize);
+ sal_uInt32 nCount = pWMF->ReadBytes(aBuf.data(), nCurRecSize);
if( nCount == nCurRecSize )
- pEMFStream->WriteBytes(pBuf.get(), nCount);
+ pEMFStream->WriteBytes(aBuf.data(), nCount);
}
}
}