<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[185766] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/185766">185766</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2015-06-19 13:45:54 -0700 (Fri, 19 Jun 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>All calls of ImageBuffer::create should null check the return value
https://bugs.webkit.org/show_bug.cgi?id=22132
Reviewed by Zalan Bujtas.
ImageBuffer::create returns nullptr for a number of reasons, and should be
expected to do so. We missed this check in a few places, resulting in
crashes on some systems. Likewise, ImageBuffer::copyImage may return nullptr
in normal use and should be checked.
Source/WebCore:
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::drawPattern): Add nullptr check for create and copyImage. Remove
extra call to 'setImageObserver'.
* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBuffer::drawPattern): Add nullptr check for copyImage.
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::drawPattern): Add nullptr checks for copyImage.
* platform/graphics/filters/FETile.cpp:
(WebCore::FETile::platformApplySoftware): Add nullptr check for copyImage.
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::asImageBuffer): Add nullptr check for create.
(WebCore::FilterEffect::openCLImageToImageBuffer): Ditto.
* platform/graphics/texmap/BitmapTexture.cpp:
(WebCore::BitmapTexture::updateContents): Add nullptr checks for create and copyImage.
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::drawPatternForContainer): Add nullptr check for copyImage.
Source/WebKit/mac:
* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::imageForCurrentSharingServicePickerItem): Add nullptr check
for copyImage.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsBitmapImagecpp">trunk/Source/WebCore/platform/graphics/BitmapImage.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscairoImageBufferCairocpp">trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgImageBufferCGcpp">trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFETilecpp">trunk/Source/WebCore/platform/graphics/filters/FETile.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFilterEffectcpp">trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicstexmapBitmapTexturecpp">trunk/Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp</a></li>
<li><a href="#trunkSourceWebCoresvggraphicsSVGImagecpp">trunk/Source/WebCore/svg/graphics/SVGImage.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebContextMenuClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (185765 => 185766)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-06-19 20:40:11 UTC (rev 185765)
+++ trunk/Source/WebCore/ChangeLog        2015-06-19 20:45:54 UTC (rev 185766)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2015-06-19 Brent Fulgham <bfulgham@apple.com>
+
+ All calls of ImageBuffer::create should null check the return value
+ https://bugs.webkit.org/show_bug.cgi?id=22132
+
+ Reviewed by Zalan Bujtas.
+
+ ImageBuffer::create returns nullptr for a number of reasons, and should be
+ expected to do so. We missed this check in a few places, resulting in
+ crashes on some systems. Likewise, ImageBuffer::copyImage may return nullptr
+ in normal use and should be checked.
+
+ * platform/graphics/BitmapImage.cpp:
+ (WebCore::BitmapImage::drawPattern): Add nullptr check for create and copyImage. Remove
+ extra call to 'setImageObserver'.
+ * platform/graphics/cairo/ImageBufferCairo.cpp:
+ (WebCore::ImageBuffer::drawPattern): Add nullptr check for copyImage.
+ * platform/graphics/cg/ImageBufferCG.cpp:
+ (WebCore::ImageBuffer::drawPattern): Add nullptr checks for copyImage.
+ * platform/graphics/filters/FETile.cpp:
+ (WebCore::FETile::platformApplySoftware): Add nullptr check for copyImage.
+ * platform/graphics/filters/FilterEffect.cpp:
+ (WebCore::FilterEffect::asImageBuffer): Add nullptr check for create.
+ (WebCore::FilterEffect::openCLImageToImageBuffer): Ditto.
+ * platform/graphics/texmap/BitmapTexture.cpp:
+ (WebCore::BitmapTexture::updateContents): Add nullptr checks for create and copyImage.
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::drawPatternForContainer): Add nullptr check for copyImage.
+
</ins><span class="cx"> 2015-06-19 Jeremy Jones <jeremyj@apple.com>
</span><span class="cx">
</span><span class="cx"> Get CAContext directly for CALayer instead of walking the layer tree.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsBitmapImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (185765 => 185766)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/BitmapImage.cpp        2015-06-19 20:40:11 UTC (rev 185765)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.cpp        2015-06-19 20:45:54 UTC (rev 185766)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx"> * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
</span><del>- * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2004, 2005, 2006, 2008, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -617,13 +617,14 @@
</span><span class="cx"> }
</span><span class="cx"> if (!m_cachedImage) {
</span><span class="cx"> std::unique_ptr<ImageBuffer> buffer = ImageBuffer::create(expandedIntSize(tileRect.size()));
</span><del>- ASSERT(buffer.get());
</del><ins>+ if (!buffer)
+ return;
</ins><span class="cx">
</span><span class="cx"> ImageObserver* observer = imageObserver();
</span><span class="cx"> ASSERT(observer);
</span><span class="cx">
</span><span class="cx"> // Temporarily reset image observer, we don't want to receive any changeInRect() calls due to this relayout.
</span><del>- setImageObserver(0);
</del><ins>+ setImageObserver(nullptr);
</ins><span class="cx">
</span><span class="cx"> draw(buffer->context(), tileRect, tileRect, styleColorSpace, op, blendMode, ImageOrientationDescription());
</span><span class="cx">
</span><span class="lines">@@ -631,9 +632,10 @@
</span><span class="cx"> buffer->convertToLuminanceMask();
</span><span class="cx">
</span><span class="cx"> m_cachedImage = buffer->copyImage(DontCopyBackingStore, Unscaled);
</span><ins>+ if (!m_cachedImage)
+ return;
+
</ins><span class="cx"> m_cachedImage->setSpaceSize(spaceSize());
</span><del>-
- setImageObserver(observer);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ctxt->setDrawLuminanceMask(false);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscairoImageBufferCairocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp (185765 => 185766)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp        2015-06-19 20:40:11 UTC (rev 185765)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp        2015-06-19 20:45:54 UTC (rev 185766)
</span><span class="lines">@@ -161,8 +161,8 @@
</span><span class="cx"> void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform,
</span><span class="cx"> const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect, BlendMode)
</span><span class="cx"> {
</span><del>- RefPtr<Image> image = copyImage(DontCopyBackingStore);
- image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
</del><ins>+ if (RefPtr<Image> image = copyImage(DontCopyBackingStore))
+ image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgImageBufferCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp (185765 => 185766)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp        2015-06-19 20:40:11 UTC (rev 185765)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp        2015-06-19 20:45:54 UTC (rev 185766)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx"> * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
</span><del>- * Copyright (C) 2008 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2008, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
</span><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -254,15 +254,15 @@
</span><span class="cx">
</span><span class="cx"> if (!context()->isAcceleratedContext()) {
</span><span class="cx"> if (destContext == context() || destContext->isAcceleratedContext()) {
</span><del>- RefPtr<Image> copy = copyImage(CopyBackingStore); // Drawing into our own buffer, need to deep copy.
- copy->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, styleColorSpace, op, destRect, blendMode);
</del><ins>+ if (RefPtr<Image> copy = copyImage(CopyBackingStore)) // Drawing into our own buffer, need to deep copy.
+ copy->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, styleColorSpace, op, destRect, blendMode);
</ins><span class="cx"> } else {
</span><del>- RefPtr<Image> imageForRendering = copyImage(DontCopyBackingStore);
- imageForRendering->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, styleColorSpace, op, destRect, blendMode);
</del><ins>+ if (RefPtr<Image> imageForRendering = copyImage(DontCopyBackingStore))
+ imageForRendering->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, styleColorSpace, op, destRect, blendMode);
</ins><span class="cx"> }
</span><span class="cx"> } else {
</span><del>- RefPtr<Image> copy = copyImage(CopyBackingStore);
- copy->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, styleColorSpace, op, destRect, blendMode);
</del><ins>+ if (RefPtr<Image> copy = copyImage(CopyBackingStore))
+ copy->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, styleColorSpace, op, destRect, blendMode);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFETilecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FETile.cpp (185765 => 185766)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FETile.cpp        2015-06-19 20:40:11 UTC (rev 185765)
+++ trunk/Source/WebCore/platform/graphics/filters/FETile.cpp        2015-06-19 20:45:54 UTC (rev 185766)
</span><span class="lines">@@ -71,8 +71,12 @@
</span><span class="cx"> tileImageContext->translate(-inMaxEffectLocation.x(), -inMaxEffectLocation.y());
</span><span class="cx"> tileImageContext->drawImageBuffer(in->asImageBuffer(), ColorSpaceDeviceRGB, in->absolutePaintRect().location());
</span><span class="cx">
</span><del>- auto pattern = Pattern::create(tileImage->copyImage(CopyBackingStore), true, true);
</del><ins>+ auto tileImageCopy = tileImage->copyImage(CopyBackingStore);
+ if (!tileImageCopy)
+ return;
</ins><span class="cx">
</span><ins>+ auto pattern = Pattern::create(tileImageCopy, true, true);
+
</ins><span class="cx"> AffineTransform patternTransform;
</span><span class="cx"> patternTransform.translate(inMaxEffectLocation.x() - maxEffectLocation.x(), inMaxEffectLocation.y() - maxEffectLocation.y());
</span><span class="cx"> pattern.get().setPatternSpaceTransform(patternTransform);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFilterEffectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp (185765 => 185766)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp        2015-06-19 20:40:11 UTC (rev 185765)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp        2015-06-19 20:45:54 UTC (rev 185766)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
</span><span class="cx"> * Copyright (C) Research In Motion Limited 2010. All rights reserved.
</span><span class="cx"> * Copyright (C) 2012 University of Szeged
</span><ins>+ * Copyright (C) 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * This library is free software; you can redistribute it and/or
</span><span class="cx"> * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -268,7 +269,7 @@
</span><span class="cx"> ImageBuffer* FilterEffect::asImageBuffer()
</span><span class="cx"> {
</span><span class="cx"> if (!hasResult())
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> if (m_imageBufferResult)
</span><span class="cx"> return m_imageBufferResult.get();
</span><span class="cx"> #if ENABLE(OPENCL)
</span><span class="lines">@@ -276,6 +277,9 @@
</span><span class="cx"> return openCLImageToImageBuffer();
</span><span class="cx"> #endif
</span><span class="cx"> m_imageBufferResult = ImageBuffer::create(m_absolutePaintRect.size(), m_filter.filterScale(), m_resultColorSpace, m_filter.renderingMode());
</span><ins>+ if (!m_imageBufferResult)
+ return nullptr;
+
</ins><span class="cx"> IntRect destinationRect(IntPoint(), m_absolutePaintRect.size());
</span><span class="cx"> if (m_premultipliedImageResult)
</span><span class="cx"> m_imageBufferResult->putByteArray(Premultiplied, m_premultipliedImageResult.get(), destinationRect.size(), destinationRect, IntPoint());
</span><span class="lines">@@ -291,7 +295,7 @@
</span><span class="cx"> ASSERT(context);
</span><span class="cx">
</span><span class="cx"> if (context->inError())
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx">
</span><span class="cx"> size_t origin[3] = { 0, 0, 0 };
</span><span class="cx"> size_t region[3] = { m_absolutePaintRect.width(), m_absolutePaintRect.height(), 1 };
</span><span class="lines">@@ -299,12 +303,15 @@
</span><span class="cx"> RefPtr<Uint8ClampedArray> destinationPixelArray = Uint8ClampedArray::create(m_absolutePaintRect.width() * m_absolutePaintRect.height() * 4);
</span><span class="cx">
</span><span class="cx"> if (context->isFailed(clFinish(context->commandQueue())))
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx">
</span><span class="cx"> if (context->isFailed(clEnqueueReadImage(context->commandQueue(), m_openCLImageResult, CL_TRUE, origin, region, 0, 0, destinationPixelArray->data(), 0, 0, 0)))
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx">
</span><span class="cx"> m_imageBufferResult = ImageBuffer::create(m_absolutePaintRect.size());
</span><ins>+ if (!m_imageBufferResult)
+ return nullptr;
+
</ins><span class="cx"> IntRect destinationRect(IntPoint(), m_absolutePaintRect.size());
</span><span class="cx"> m_imageBufferResult->putByteArray(Unmultiplied, destinationPixelArray.get(), destinationRect.size(), destinationRect, IntPoint());
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicstexmapBitmapTexturecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp (185765 => 185766)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp        2015-06-19 20:40:11 UTC (rev 185765)
+++ trunk/Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp        2015-06-19 20:45:54 UTC (rev 185766)
</span><span class="lines">@@ -50,6 +50,8 @@
</span><span class="cx"> sourceLayer->paintGraphicsLayerContents(*context, sourceRect);
</span><span class="cx">
</span><span class="cx"> RefPtr<Image> image = imageBuffer->copyImage(DontCopyBackingStore);
</span><ins>+ if (!image)
+ return;
</ins><span class="cx">
</span><span class="cx"> updateContents(image.get(), targetRect, IntPoint(), updateContentsFlag);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoresvggraphicsSVGImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (185765 => 185766)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp        2015-06-19 20:40:11 UTC (rev 185765)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp        2015-06-19 20:45:54 UTC (rev 185766)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx"> * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
</span><del>- * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2008, 2009, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> * Copyright (C) Research In Motion Limited 2011. All rights reserved.
</span><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -207,6 +207,8 @@
</span><span class="cx"> buffer->convertToLuminanceMask();
</span><span class="cx">
</span><span class="cx"> RefPtr<Image> image = buffer->copyImage(DontCopyBackingStore, Unscaled);
</span><ins>+ if (!image)
+ return;
</ins><span class="cx"> image->setSpaceSize(spaceSize());
</span><span class="cx">
</span><span class="cx"> // Adjust the source rect and transform due to the image buffer's scaling.
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (185765 => 185766)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2015-06-19 20:40:11 UTC (rev 185765)
+++ trunk/Source/WebKit/mac/ChangeLog        2015-06-19 20:45:54 UTC (rev 185766)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-06-19 Brent Fulgham <bfulgham@apple.com>
+
+ All calls of ImageBuffer::create should null check the return value
+ https://bugs.webkit.org/show_bug.cgi?id=22132
+
+ Reviewed by Zalan Bujtas.
+
+ ImageBuffer::create returns nullptr for a number of reasons, and should be
+ expected to do so. We missed this check in a few places, resulting in
+ crashes on some systems. Likewise, ImageBuffer::copyImage may return nullptr
+ in normal use and should be checked.
+
+ * WebCoreSupport/WebContextMenuClient.mm:
+ (WebContextMenuClient::imageForCurrentSharingServicePickerItem): Add nullptr check
+ for copyImage.
+
</ins><span class="cx"> 2015-06-18 Jon Lee <jonlee@apple.com>
</span><span class="cx">
</span><span class="cx"> Update AVKit usage of pip
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebContextMenuClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm (185765 => 185766)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm        2015-06-19 20:40:11 UTC (rev 185765)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm        2015-06-19 20:45:54 UTC (rev 185766)
</span><span class="lines">@@ -483,6 +483,9 @@
</span><span class="cx"> frameView->setPaintBehavior(oldPaintBehavior);
</span><span class="cx">
</span><span class="cx"> RefPtr<Image> image = buffer->copyImage(DontCopyBackingStore);
</span><ins>+ if (!image)
+ return nil;
+
</ins><span class="cx"> return image->getNSImage();
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>
</body>
</html>