Kaydet (Commit) 5e30823e authored tarafından Mike Kaganski's avatar Mike Kaganski

tdf#120703 PVS: GetBitmapBits does not return required buffer size

... unlike GetMetaFileBitsEx or GetEnhMetaFileBits, which are used
in the other branches. The implementation is trying to pass nullptr
to the function since commit 41e72962

Just calculate the required buffer size using BITMAP struct filled
by GetObject call.

V575 The null pointer is passed into 'GetBitmapBits' function.
     Inspect the third argument.

Change-Id: I0d164694c99d805fd59b65ea1b4df4919a89e130
Reviewed-on: https://gerrit.libreoffice.org/70012
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 3b25ea6d
......@@ -334,7 +334,13 @@ bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium,
else if ( aMedium.tymed == TYMED_GDI ) // Bitmap
{
aFormat = "image/x-MS-bmp";
nBufSize = GetBitmapBits( aMedium.hBitmap, 0, nullptr );
// Find out size of buffer: deprecated GetBitmapBits does not have a mode to return
// required buffer size
BITMAP aBmp;
GetObjectW(aMedium.hBitmap, sizeof(aBmp), &aBmp);
nBufSize = aBmp.bmWidthBytes * aBmp.bmHeight;
pBuf.reset(new sal_Int8[nBufSize]);
if ( nBufSize && nBufSize == sal::static_int_cast< ULONG >( GetBitmapBits( aMedium.hBitmap, nBufSize, pBuf.get() ) ) )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment