diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx index d1e7f85b1c67..58c4d971cb49 100644 --- a/emfio/source/reader/wmfreader.cxx +++ b/emfio/source/reader/wmfreader.cxx @@ -711,9 +711,15 @@ namespace emfio bool bOk = nWidth && nHeight && nPlanes == 1 && nBitCount == 1 && nBytesPerScan != 0; if (bOk) { + // must be enough data to fulfil the request bOk = nBytesPerScan <= mpInputStream->remainingSize() / nHeight; } if (bOk) + { + // scanline must be large enough to provide all pixels + bOk = nBytesPerScan >= nWidth / 8; + } + if (bOk) { vcl::bitmap::RawBitmap aBmp( Size( nWidth, nHeight ), 24 ); for (sal_uInt16 y = 0; y < nHeight && mpInputStream->good(); ++y)