Kaydet (Commit) cd292ba1 authored tarafından Michael Stahl's avatar Michael Stahl

vcl: avoid vcl_filters_test crash with ASAN 32-bit

ASAN usually aborts on operator new[] allocation failure but with
allocator_may_return_null=1 in ASAN_OPTIONS it returns null instead; it
doesn't throw std::bad_alloc though.

Change-Id: I28d67a787e90604c12ad06fd97d265664bd62ef2
üst ed2d342e
......@@ -125,7 +125,17 @@ BitmapBuffer* ImplCreateDIB(
{
size_t size = pDIB->mnScanlineSize * pDIB->mnHeight;
pDIB->mpBits = new sal_uInt8[size];
std::memset(pDIB->mpBits, 0, size);
#ifdef __SANITIZE_ADDRESS__
if (!pDIB->mpBits)
{ // can only happen with ASAN allocator_may_return_null=1
delete pDIB;
pDIB = nullptr;
}
else
#endif
{
std::memset(pDIB->mpBits, 0, size);
}
}
catch (const std::bad_alloc&)
{
......
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