<!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>[204803] releases/WebKitGTK/webkit-2.12</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/204803">204803</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2016-08-23 04:08:22 -0700 (Tue, 23 Aug 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/202887">r202887</a> - Return values of JSArray::createUninitialized (and related) are not consistently checked for nullptr
https://bugs.webkit.org/show_bug.cgi?id=159495
<rdar://problem/26075433>
Reviewed by Dean Jackson.
Source/WebCore:
Test: fast/canvas/canvas-getImageData-invalid-result-buffer-crash.html
* html/ImageData.cpp:
(WebCore::ImageData::ImageData): Assert at construction if we could not create a valid
buffer.
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::createArrayBuffer): Check for a null buffer before using it.
* platform/graphics/cg/ImageBufferDataCG.cpp:
(WebCore::ImageBufferData::getData): Ditto.
* platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::FEGaussianBlur::platformApplySoftware): Ditto.
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::copyImageBytes): Ditto.
(WebCore::FilterEffect::copyUnmultipliedImage): Ditto.
(WebCore::FilterEffect::copyPremultipliedImage): Ditto.
LayoutTests:
* fast/canvas/canvas-getImageData-invalid-result-buffer-crash.html: Added.
* fast/canvas/canvas-getImageData-invalid-result-buffer-crash-expected.txt: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit212LayoutTestsChangeLog">releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceWebCorehtmlImageDatacpp">releases/WebKitGTK/webkit-2.12/Source/WebCore/html/ImageData.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceWebCorehtmlcanvasCanvasRenderingContext2Dcpp">releases/WebKitGTK/webkit-2.12/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceWebCoreplatformSharedBuffercpp">releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/SharedBuffer.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceWebCoreplatformgraphicscgImageBufferDataCGcpp">releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceWebCoreplatformgraphicsfiltersFEGaussianBlurcpp">releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceWebCoreplatformgraphicsfiltersFilterEffectcpp">releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/graphics/filters/FilterEffect.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit212LayoutTestsfastcanvascanvasgetImageDatainvalidresultbuffercrashexpectedtxt">releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/canvas-getImageData-invalid-result-buffer-crash-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit212LayoutTestsfastcanvascanvasgetImageDatainvalidresultbuffercrashhtml">releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/canvas-getImageData-invalid-result-buffer-crash.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit212LayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog (204802 => 204803)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog        2016-08-23 11:03:00 UTC (rev 204802)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog        2016-08-23 11:08:22 UTC (rev 204803)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-07-06 Brent Fulgham <bfulgham@apple.com>
+
+ Return values of JSArray::createUninitialized (and related) are not consistently checked for nullptr
+ https://bugs.webkit.org/show_bug.cgi?id=159495
+ <rdar://problem/26075433>
+
+ Reviewed by Dean Jackson.
+
+ * fast/canvas/canvas-getImageData-invalid-result-buffer-crash.html: Added.
+ * fast/canvas/canvas-getImageData-invalid-result-buffer-crash-expected.txt: Added.
+
</ins><span class="cx"> 2016-07-26 Said Abou-Hallawa <sabouhallawa@apple.com>
</span><span class="cx">
</span><span class="cx"> Infinite Canvas context save() causes WebKit to crash
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit212LayoutTestsfastcanvascanvasgetImageDatainvalidresultbuffercrashexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/canvas-getImageData-invalid-result-buffer-crash-expected.txt (0 => 204803)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/canvas-getImageData-invalid-result-buffer-crash-expected.txt         (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/canvas-getImageData-invalid-result-buffer-crash-expected.txt        2016-08-23 11:08:22 UTC (rev 204803)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+CONSOLE MESSAGE: line 8: Unable to get image data from canvas. Requested size was 381000000 x 2
+CONSOLE MESSAGE: line 8: InvalidStateError: DOM Exception 11: The object is in an invalid state.
+PASSED (If this page did not crash.)
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit212LayoutTestsfastcanvascanvasgetImageDatainvalidresultbuffercrashhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/canvas-getImageData-invalid-result-buffer-crash.html (0 => 204803)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/canvas-getImageData-invalid-result-buffer-crash.html         (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/canvas-getImageData-invalid-result-buffer-crash.html        2016-08-23 11:08:22 UTC (rev 204803)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+function runTest() {
+ var canvas = document.getElementById("test");
+ var ctx = canvas.getContext("2d");
+ ctx.getImageData(10000, 125, -381000000, -0.9);
+}
+</script>
+</head>
+<body onload="runTest()">
+ <canvas id="test" width="1000" height="1000"></canvas>
+PASSED (If this page did not crash.)
+ <pre id='console'></pre>
+ <script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog (204802 => 204803)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog        2016-08-23 11:03:00 UTC (rev 204802)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog        2016-08-23 11:08:22 UTC (rev 204803)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2016-07-06 Brent Fulgham <bfulgham@apple.com>
+
+ Return values of JSArray::createUninitialized (and related) are not consistently checked for nullptr
+ https://bugs.webkit.org/show_bug.cgi?id=159495
+ <rdar://problem/26075433>
+
+ Reviewed by Dean Jackson.
+
+ Test: fast/canvas/canvas-getImageData-invalid-result-buffer-crash.html
+
+ * html/ImageData.cpp:
+ (WebCore::ImageData::ImageData): Assert at construction if we could not create a valid
+ buffer.
+ * platform/SharedBuffer.cpp:
+ (WebCore::SharedBuffer::createArrayBuffer): Check for a null buffer before using it.
+ * platform/graphics/cg/ImageBufferDataCG.cpp:
+ (WebCore::ImageBufferData::getData): Ditto.
+ * platform/graphics/filters/FEGaussianBlur.cpp:
+ (WebCore::FEGaussianBlur::platformApplySoftware): Ditto.
+ * platform/graphics/filters/FilterEffect.cpp:
+ (WebCore::FilterEffect::copyImageBytes): Ditto.
+ (WebCore::FilterEffect::copyUnmultipliedImage): Ditto.
+ (WebCore::FilterEffect::copyPremultipliedImage): Ditto.
+
</ins><span class="cx"> 2016-07-26 Said Abou-Hallawa <sabouhallawa@apple.com>
</span><span class="cx">
</span><span class="cx"> Infinite Canvas context save() causes WebKit to crash
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceWebCorehtmlImageDatacpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/html/ImageData.cpp (204802 => 204803)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/WebCore/html/ImageData.cpp        2016-08-23 11:03:00 UTC (rev 204802)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/html/ImageData.cpp        2016-08-23 11:08:22 UTC (rev 204803)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2008 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2008-2016 Apple Inc. All rights reserved.
</ins><span class="cx"> * Copyright (C) 2014 Adobe Systems Incorporated. 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">@@ -115,6 +115,7 @@
</span><span class="cx"> : m_size(size)
</span><span class="cx"> , m_data(Uint8ClampedArray::createUninitialized(size.width() * size.height() * 4))
</span><span class="cx"> {
</span><ins>+ ASSERT_WITH_SECURITY_IMPLICATION(m_data);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ImageData::ImageData(const IntSize& size, PassRefPtr<Uint8ClampedArray> byteArray)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceWebCorehtmlcanvasCanvasRenderingContext2Dcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (204802 => 204803)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp        2016-08-23 11:03:00 UTC (rev 204802)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp        2016-08-23 11:08:22 UTC (rev 204803)
</span><span class="lines">@@ -2103,8 +2103,17 @@
</span><span class="cx"> return createEmptyImageData(imageDataRect.size());
</span><span class="cx">
</span><span class="cx"> RefPtr<Uint8ClampedArray> byteArray = buffer->getUnmultipliedImageData(imageDataRect, coordinateSystem);
</span><del>- if (!byteArray)
</del><ins>+ if (!byteArray) {
+ StringBuilder consoleMessage;
+ consoleMessage.appendLiteral("Unable to get image data from canvas. Requested size was ");
+ consoleMessage.appendNumber(imageDataRect.width());
+ consoleMessage.appendLiteral(" x ");
+ consoleMessage.appendNumber(imageDataRect.height());
+
+ canvas()->document().addConsoleMessage(MessageSource::Rendering, MessageLevel::Error, consoleMessage.toString());
+ ec = INVALID_STATE_ERR;
</ins><span class="cx"> return nullptr;
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> return ImageData::create(imageDataRect.size(), byteArray.release());
</span><span class="cx"> }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceWebCoreplatformSharedBuffercpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/SharedBuffer.cpp (204802 => 204803)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/SharedBuffer.cpp        2016-08-23 11:03:00 UTC (rev 204802)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/SharedBuffer.cpp        2016-08-23 11:08:22 UTC (rev 204803)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
</ins><span class="cx"> * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
</span><span class="cx"> * Copyright (C) 2015 Canon Inc. All rights reserved.
</span><span class="cx"> *
</span><span class="lines">@@ -144,6 +144,10 @@
</span><span class="cx"> PassRefPtr<ArrayBuffer> SharedBuffer::createArrayBuffer() const
</span><span class="cx"> {
</span><span class="cx"> RefPtr<ArrayBuffer> arrayBuffer = ArrayBuffer::createUninitialized(static_cast<unsigned>(size()), sizeof(char));
</span><ins>+ if (!arrayBuffer) {
+ WTFLogAlways("SharedBuffer::createArrayBuffer Unable to create buffer. Requested size was %d x %lu\n", size(), sizeof(char));
+ return nullptr;
+ }
</ins><span class="cx">
</span><span class="cx"> const char* segment = 0;
</span><span class="cx"> unsigned position = 0;
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceWebCoreplatformgraphicscgImageBufferDataCGcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp (204802 => 204803)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp        2016-08-23 11:03:00 UTC (rev 204802)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp        2016-08-23 11:08:22 UTC (rev 204803)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2011 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2011-2016 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">@@ -96,11 +96,9 @@
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> RefPtr<Uint8ClampedArray> result = Uint8ClampedArray::createUninitialized(area.unsafeGet());
</span><del>- unsigned char* resultData = result->data();
- if (!resultData) {
- WTFLogAlways("ImageBufferData: Unable to create buffer. Requested size was %d x %d = %u\n", rect.width(), rect.height(), area.unsafeGet());
</del><ins>+ unsigned char* resultData = result ? result->data() : nullptr;
+ if (!resultData)
</ins><span class="cx"> return nullptr;
</span><del>- }
</del><span class="cx">
</span><span class="cx"> Checked<int> endx = rect.maxX();
</span><span class="cx"> endx *= ceilf(resolutionScale);
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceWebCoreplatformgraphicsfiltersFEGaussianBlurcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp (204802 => 204803)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp        2016-08-23 11:03:00 UTC (rev 204802)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp        2016-08-23 11:08:22 UTC (rev 204803)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx"> * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
</span><span class="cx"> * Copyright (C) 2010 Igalia, S.L.
</span><span class="cx"> * Copyright (C) Research In Motion Limited 2010. All rights reserved.
</span><del>- * Copyright (C) 2015 Apple, Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2015-2016 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">@@ -540,9 +540,12 @@
</span><span class="cx"> IntSize paintSize = absolutePaintRect().size();
</span><span class="cx"> paintSize.scale(filter().filterScale());
</span><span class="cx"> RefPtr<Uint8ClampedArray> tmpImageData = Uint8ClampedArray::createUninitialized(paintSize.width() * paintSize.height() * 4);
</span><del>- Uint8ClampedArray* tmpPixelArray = tmpImageData.get();
</del><ins>+ if (!tmpImageData) {
+ WTFLogAlways("FEGaussianBlur::platformApplySoftware Unable to create buffer. Requested size was %d x %d\n", paintSize.width(), paintSize.height());
+ return;
+ }
</ins><span class="cx">
</span><del>- platformApply(srcPixelArray, tmpPixelArray, kernelSize.width(), kernelSize.height(), paintSize);
</del><ins>+ platformApply(srcPixelArray, tmpImageData.get(), kernelSize.width(), kernelSize.height(), paintSize);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void FEGaussianBlur::dump()
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceWebCoreplatformgraphicsfiltersFilterEffectcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/graphics/filters/FilterEffect.cpp (204802 => 204803)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/graphics/filters/FilterEffect.cpp        2016-08-23 11:03:00 UTC (rev 204802)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/platform/graphics/filters/FilterEffect.cpp        2016-08-23 11:08:22 UTC (rev 204803)
</span><span class="lines">@@ -3,7 +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><del>- * Copyright (C) 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2015-2016 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">@@ -260,6 +260,9 @@
</span><span class="cx"> IntSize scaledPaintSize(m_absolutePaintRect.size());
</span><span class="cx"> scaledPaintSize.scale(m_filter.filterScale());
</span><span class="cx">
</span><ins>+ if (!source || !destination)
+ return;
+
</ins><span class="cx"> // Initialize the destination to transparent black, if not entirely covered by the source.
</span><span class="cx"> if (scaledRect.x() < 0 || scaledRect.y() < 0 || scaledRect.maxX() > scaledPaintSize.width() || scaledRect.maxY() > scaledPaintSize.height())
</span><span class="cx"> memset(destination->data(), 0, destination->length());
</span><span class="lines">@@ -315,6 +318,10 @@
</span><span class="cx"> ASSERT(!ImageBuffer::sizeNeedsClamping(inputSize));
</span><span class="cx"> inputSize.scale(m_filter.filterScale());
</span><span class="cx"> m_unmultipliedImageResult = Uint8ClampedArray::createUninitialized(inputSize.width() * inputSize.height() * 4);
</span><ins>+ if (!m_unmultipliedImageResult) {
+ WTFLogAlways("FilterEffect::copyUnmultipliedImage Unable to create buffer. Requested size was %d x %d\n", inputSize.width(), inputSize.height());
+ return;
+ }
</ins><span class="cx"> unsigned char* sourceComponent = m_premultipliedImageResult->data();
</span><span class="cx"> unsigned char* destinationComponent = m_unmultipliedImageResult->data();
</span><span class="cx"> unsigned char* end = sourceComponent + (inputSize.width() * inputSize.height() * 4);
</span><span class="lines">@@ -351,6 +358,10 @@
</span><span class="cx"> ASSERT(!ImageBuffer::sizeNeedsClamping(inputSize));
</span><span class="cx"> inputSize.scale(m_filter.filterScale());
</span><span class="cx"> m_premultipliedImageResult = Uint8ClampedArray::createUninitialized(inputSize.width() * inputSize.height() * 4);
</span><ins>+ if (!m_premultipliedImageResult) {
+ WTFLogAlways("FilterEffect::copyPremultipliedImage Unable to create buffer. Requested size was %d x %d\n", inputSize.width(), inputSize.height());
+ return;
+ }
</ins><span class="cx"> unsigned char* sourceComponent = m_unmultipliedImageResult->data();
</span><span class="cx"> unsigned char* destinationComponent = m_premultipliedImageResult->data();
</span><span class="cx"> unsigned char* end = sourceComponent + (inputSize.width() * inputSize.height() * 4);
</span></span></pre>
</div>
</div>
</body>
</html>