Title: [253806] trunk
Revision
253806
Author
[email protected]
Date
2019-12-19 18:03:51 -0800 (Thu, 19 Dec 2019)

Log Message

Nullptr crash in WebCore::RenderTreeBuilder::attach
https://bugs.webkit.org/show_bug.cgi?id=205476

Patch by Jack Lee <[email protected]> on 2019-12-19
Reviewed by Ryosuke Niwa.

Source/WebCore:

Test: fast/ruby/crash-insert-duplicate-rt-element.html

* rendering/updating/RenderTreeBuilderRuby.cpp:
(WebCore::RenderTreeBuilder::Ruby::attach):

LayoutTests:

* fast/ruby/crash-insert-duplicate-rt-element-expected.txt: Added.
* fast/ruby/crash-insert-duplicate-rt-element.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (253805 => 253806)


--- trunk/LayoutTests/ChangeLog	2019-12-20 02:00:56 UTC (rev 253805)
+++ trunk/LayoutTests/ChangeLog	2019-12-20 02:03:51 UTC (rev 253806)
@@ -1,5 +1,15 @@
 2019-12-19  Jack Lee  <[email protected]>
 
+        Nullptr crash in WebCore::RenderTreeBuilder::attach
+        https://bugs.webkit.org/show_bug.cgi?id=205476
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/ruby/crash-insert-duplicate-rt-element-expected.txt: Added.
+        * fast/ruby/crash-insert-duplicate-rt-element.html: Added.
+
+2019-12-19  Jack Lee  <[email protected]>
+
         Nullptr crash in WebCore::findPlaceForCounter with display: contents parent
         https://bugs.webkit.org/show_bug.cgi?id=205290
 

Added: trunk/LayoutTests/fast/ruby/crash-insert-duplicate-rt-element-expected.txt (0 => 253806)


--- trunk/LayoutTests/fast/ruby/crash-insert-duplicate-rt-element-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/ruby/crash-insert-duplicate-rt-element-expected.txt	2019-12-20 02:03:51 UTC (rev 253806)
@@ -0,0 +1,2 @@
+This tests inserting a duplicate rt element into ruby. WebKit should not crash.
+PASS.

Added: trunk/LayoutTests/fast/ruby/crash-insert-duplicate-rt-element.html (0 => 253806)


--- trunk/LayoutTests/fast/ruby/crash-insert-duplicate-rt-element.html	                        (rev 0)
+++ trunk/LayoutTests/fast/ruby/crash-insert-duplicate-rt-element.html	2019-12-20 02:03:51 UTC (rev 253806)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+function runTest() {
+    document.body.getBoundingClientRect();
+    document.querySelector('ruby').prepend(document.createElement("rt"));
+    document.body.getBoundingClientRect();
+
+    document.body.innerHTML = `<p>This tests inserting a duplicate rt element into ruby. WebKit should not crash.<br>PASS.</p>`;
+
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+</script>
+<body _onload_="runTest()"><ruby><rt></body>
+

Modified: trunk/Source/WebCore/ChangeLog (253805 => 253806)


--- trunk/Source/WebCore/ChangeLog	2019-12-20 02:00:56 UTC (rev 253805)
+++ trunk/Source/WebCore/ChangeLog	2019-12-20 02:03:51 UTC (rev 253806)
@@ -1,5 +1,17 @@
 2019-12-19  Jack Lee  <[email protected]>
 
+        Nullptr crash in WebCore::RenderTreeBuilder::attach
+        https://bugs.webkit.org/show_bug.cgi?id=205476
+
+        Reviewed by Ryosuke Niwa.
+
+        Test: fast/ruby/crash-insert-duplicate-rt-element.html
+
+        * rendering/updating/RenderTreeBuilderRuby.cpp:
+        (WebCore::RenderTreeBuilder::Ruby::attach):
+
+2019-12-19  Jack Lee  <[email protected]>
+
         Nullptr crash in WebCore::findPlaceForCounter with display: contents parent
         https://bugs.webkit.org/show_bug.cgi?id=205290
 

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp (253805 => 253806)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp	2019-12-20 02:00:56 UTC (rev 253805)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp	2019-12-20 02:03:51 UTC (rev 253806)
@@ -215,6 +215,7 @@
             RenderElement* ruby = parent.parent();
             ASSERT(isRuby(ruby));
             auto newRun = RenderRubyRun::staticCreateRubyRun(ruby);
+            auto& run = *newRun;
             m_builder.attach(*ruby, WTFMove(newRun), parent.nextSibling());
             // Add the new ruby text and move the old one to the new run
             // Note: Doing it in this order and not using RenderRubyRun's methods,
@@ -223,7 +224,7 @@
             m_builder.blockFlowBuilder().attach(parent, WTFMove(child), beforeChild);
             auto takenBeforeChild = m_builder.blockBuilder().detach(parent, *beforeChild);
 
-            m_builder.attach(*newRun, WTFMove(takenBeforeChild));
+            m_builder.attach(run, WTFMove(takenBeforeChild));
             return;
         }
         if (parent.hasRubyBase()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to