From 36764b40013b19746e6caa041ab3f5100c84a4c2 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 26 May 2014 17:23:34 +0200 Subject: [PATCH] AlphaMask: add missing error check. It's possible to allocate the bitmap object, then fail allocating the bits. The WebKit testsuite is a way to trigger this, and it crashed app_server. --- src/servers/app/drawing/AlphaMask.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/servers/app/drawing/AlphaMask.cpp b/src/servers/app/drawing/AlphaMask.cpp index 69b0eb2c0a..2a595fca86 100644 --- a/src/servers/app/drawing/AlphaMask.cpp +++ b/src/servers/app/drawing/AlphaMask.cpp @@ -178,6 +178,11 @@ AlphaMask::_RenderPicture() const if (bitmap == NULL) return NULL; + if (!bitmap->IsValid()) { + delete bitmap; + return NULL; + } + // Clear the bitmap with the transparent color memset(bitmap->Bits(), 0, bitmap->BitsLength());