Skip to content

Commit

Permalink
Check If ImageBuffer is allocated before proceeding.
Browse files Browse the repository at this point in the history
This patch takes care of the left out places where 
newly created ImageBuffer is not validated.

BUG= 248420

Review URL: https://codereview.chromium.org/562543004

git-svn-id: svn://svn.chromium.org/blink/trunk@181936 bbb929c8-8fbe-4397-9dbb-9b2b20218538
  • Loading branch information
[email protected] committed Sep 12, 2014
1 parent ce0a756 commit b040a1d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Source/core/rendering/svg/RenderSVGResourceFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ static bool createImageBuffer(const Filter* filter, OwnPtr<ImageBuffer>& imageBu
if (!surface->isValid())
return false;
OwnPtr<ImageBuffer> image = ImageBuffer::create(surface.release());
if (!image)
return false;

GraphicsContext* imageContext = image->context();
ASSERT(imageContext);
Expand Down
2 changes: 2 additions & 0 deletions Source/platform/graphics/GraphicsContextTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ TEST(GraphicsContextTest, trackImageMask)
context.beginTransparencyLayer(1);

OwnPtr<ImageBuffer> alphaImage = ImageBuffer::create(IntSize(100, 100));
EXPECT_FALSE(!alphaImage);
alphaImage->context()->fillRect(IntRect(0, 0, 100, 100), alpha);

context.setCompositeOperation(CompositeSourceOver);
Expand Down Expand Up @@ -280,6 +281,7 @@ TEST(GraphicsContextTest, trackImageMaskWithOpaqueRect)
context.beginTransparencyLayer(1);

OwnPtr<ImageBuffer> alphaImage = ImageBuffer::create(IntSize(100, 100));
EXPECT_FALSE(!alphaImage);
alphaImage->context()->fillRect(IntRect(0, 0, 100, 100), alpha);

context.setCompositeOperation(CompositeSourceOver);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class RecordingImageBufferSurfaceTest : public Test {
// We create an ImageBuffer in order for the testSurface to be
// properly initialized with a GraphicsContext
m_imageBuffer = ImageBuffer::create(testSurface.release());
EXPECT_FALSE(!m_imageBuffer);
m_fakeImageBufferClient = adoptPtr(new FakeImageBufferClient(m_imageBuffer.get()));
m_imageBuffer->setClient(m_fakeImageBufferClient.get());
}
Expand Down

0 comments on commit b040a1d

Please sign in to comment.