summaryrefslogtreecommitdiff
path: root/vcl/headless
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-01-21 16:04:28 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-01-21 16:30:15 +0100
commita73e606b8cd714520285b4e40890db9fd27d7ba5 (patch)
tree109b2ed6931b00f9ebb6df1328a43ccf003dbd3e /vcl/headless
parent08680c58de1271ce42a72ce4105e5a3337d0498c (diff)
Quickfix for deterministic SvpSalBitmap checksums
...that include the junk parts of the mpDIB->mpBits array in the calculation. MALLOC_PERTURB_=153 in gb_CppunitTest_malloc_check (solenv/gbuild/platform/unxgcc.mk) causes those junk bytes to normally contain 0x66 on Linux, but ASan makes them contain 0xBE instead. Change-Id: I74429c5e539e667cb936b3a486de31867eef3e50
Diffstat (limited to 'vcl/headless')
-rw-r--r--vcl/headless/svpbmp.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx
index 2fe05d2241f0..293b222b8f8f 100644
--- a/vcl/headless/svpbmp.cxx
+++ b/vcl/headless/svpbmp.cxx
@@ -19,6 +19,10 @@
#ifndef IOS
+#include <sal/config.h>
+
+#include <cstring>
+
#include "headless/svpbmp.hxx"
#include "headless/svpgdi.hxx"
#include "headless/svpinst.hxx"
@@ -117,15 +121,17 @@ BitmapBuffer* ImplCreateDIB(
pDIB->maPalette.SetEntryCount( nColors );
}
+ auto size = pDIB->mnScanlineSize * pDIB->mnHeight;
try
{
- pDIB->mpBits = new sal_uInt8[ pDIB->mnScanlineSize * pDIB->mnHeight ];
+ pDIB->mpBits = new sal_uInt8[size];
}
catch (const std::bad_alloc&)
{
delete pDIB;
pDIB = nullptr;
}
+ std::memset(pDIB->mpBits, 0, size);
}
}
else