Title: [208628] trunk
- Revision
- 208628
- Author
- bfulg...@apple.com
- Date
- 2016-11-11 16:32:59 -0800 (Fri, 11 Nov 2016)
Log Message
Neutered ArrayBuffers are not properly serialized
https://bugs.webkit.org/show_bug.cgi?id=164647
<rdar://problem/29213490>
Reviewed by David Kilzer.
Source/WebCore:
Correct binding logic to handle ImageBuffers being deserialized from neutered ArrayBuffers.
Test: fast/canvas/neutered-imagedata.html
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readTerminal):
LayoutTests:
* fast/canvas/neutered-imagedata-expected.txt: Added.
* fast/canvas/neutered-imagedata.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (208627 => 208628)
--- trunk/LayoutTests/ChangeLog 2016-11-12 00:29:36 UTC (rev 208627)
+++ trunk/LayoutTests/ChangeLog 2016-11-12 00:32:59 UTC (rev 208628)
@@ -1,3 +1,14 @@
+2016-11-11 Brent Fulgham <bfulg...@apple.com>
+
+ Neutered ArrayBuffers are not properly serialized
+ https://bugs.webkit.org/show_bug.cgi?id=164647
+ <rdar://problem/29213490>
+
+ Reviewed by David Kilzer.
+
+ * fast/canvas/neutered-imagedata-expected.txt: Added.
+ * fast/canvas/neutered-imagedata.html: Added.
+
2016-11-11 Wenson Hsieh <wenson_hs...@apple.com>
[WK2] autocorrect and autocapitalize attributes do not work in contenteditable elements
Added: trunk/LayoutTests/fast/canvas/neutered-imagedata-expected.txt (0 => 208628)
--- trunk/LayoutTests/fast/canvas/neutered-imagedata-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/neutered-imagedata-expected.txt 2016-11-12 00:32:59 UTC (rev 208628)
@@ -0,0 +1,10 @@
+Tests that serialized image buffers account for neutered state.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Found only zeros.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/neutered-imagedata.html (0 => 208628)
--- trunk/LayoutTests/fast/canvas/neutered-imagedata.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/neutered-imagedata.html 2016-11-12 00:32:59 UTC (rev 208628)
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+<script>
+description('Tests that serialized image buffers account for neutered state.');
+
+window.jsTestIsAsync = true;
+
+function checkState(state) {
+ var elementCount = state.width * state.height;
+
+ for (var i = 0; i < elementCount; ++i) {
+ if (state.data[i] != 0) {
+ testFailed("Found non-zero data.");
+ finishJSTest();
+ return;
+ }
+ }
+
+ testPassed("Found only zeros.");
+ finishJSTest();
+}
+
+function runTest() {
+ if (window.testRunner) {
+ testRunner.dumpAsText(true);
+ testRunner.waitUntilDone();
+ }
+
+ var id = new ImageData(1, 256);
+
+ // This will neuter the data buffer.
+ postMessage("", "*", [id.data.buffer]);
+
+ history.pushState(id, "");
+
+ setTimeout(function() {
+ checkState(history.state);
+ }, 0);
+}
+</script>
+</head>
+<body _onload_="runTest()">
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (208627 => 208628)
--- trunk/Source/WebCore/ChangeLog 2016-11-12 00:29:36 UTC (rev 208627)
+++ trunk/Source/WebCore/ChangeLog 2016-11-12 00:32:59 UTC (rev 208628)
@@ -1,3 +1,18 @@
+2016-11-11 Brent Fulgham <bfulg...@apple.com>
+
+ Neutered ArrayBuffers are not properly serialized
+ https://bugs.webkit.org/show_bug.cgi?id=164647
+ <rdar://problem/29213490>
+
+ Reviewed by David Kilzer.
+
+ Correct binding logic to handle ImageBuffers being deserialized from neutered ArrayBuffers.
+
+ Test: fast/canvas/neutered-imagedata.html
+
+ * bindings/js/SerializedScriptValue.cpp:
+ (WebCore::CloneDeserializer::readTerminal):
+
2016-11-11 Wenson Hsieh <wenson_hs...@apple.com>
[WK2] autocorrect and autocapitalize attributes do not work in contenteditable elements
Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (208627 => 208628)
--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2016-11-12 00:29:36 UTC (rev 208627)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2016-11-12 00:32:59 UTC (rev 208628)
@@ -2274,7 +2274,7 @@
uint32_t length;
if (!read(length))
return JSValue();
- if (m_end < ((uint8_t*)0) + length || m_ptr > m_end - length) {
+ if (m_end - m_ptr < length) {
fail();
return JSValue();
}
@@ -2282,8 +2282,17 @@
m_ptr += length;
return jsNull();
}
- RefPtr<ImageData> result = ImageData::create(IntSize(width, height));
- memcpy(result->data()->data(), m_ptr, length);
+ IntSize imageSize(width, height);
+ RELEASE_ASSERT(!length || (imageSize.area() * 4).unsafeGet() <= length);
+ RefPtr<ImageData> result = ImageData::create(imageSize);
+ if (!result) {
+ fail();
+ return JSValue();
+ }
+ if (length)
+ memcpy(result->data()->data(), m_ptr, length);
+ else
+ result->data()->zeroFill();
m_ptr += length;
return getJSValue(result.get());
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes