Title: [288258] releases/WebKitGTK/webkit-2.34
Revision
288258
Author
[email protected]
Date
2022-01-19 17:27:25 -0800 (Wed, 19 Jan 2022)

Log Message

Merge r285813 - nullptr deref in CompositeEditCommand::insertNodeAt
https://bugs.webkit.org/show_bug.cgi?id=232837

Patch by Gabriel Nava Marino <[email protected]> on 2021-11-15
Reviewed by Wenson Hsieh and Darin Adler.

Source/WebCore:

Check endingSelection is not orphan before inserting nodes at
the start position.

Test: fast/editing/editing-position-crash.html

* editing/CreateLinkCommand.cpp:
(WebCore::CreateLinkCommand::doApply):

LayoutTests:

* fast/editing/editing-position-crash-expected.txt: Added.
* fast/editing/editing-position-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.34/LayoutTests/ChangeLog (288257 => 288258)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/ChangeLog	2022-01-20 01:22:03 UTC (rev 288257)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/ChangeLog	2022-01-20 01:27:25 UTC (rev 288258)
@@ -1,3 +1,13 @@
+2021-11-15  Gabriel Nava Marino  <[email protected]>
+
+        nullptr deref in CompositeEditCommand::insertNodeAt
+        https://bugs.webkit.org/show_bug.cgi?id=232837
+
+        Reviewed by Wenson Hsieh and Darin Adler.
+
+        * fast/editing/editing-position-crash-expected.txt: Added.
+        * fast/editing/editing-position-crash.html: Added.
+
 2021-11-03  Rob Buis  <[email protected]>
 
         Return nullopt in aspect-ratio+intrinsic width case

Added: releases/WebKitGTK/webkit-2.34/LayoutTests/fast/editing/editing-position-crash-expected.txt (0 => 288258)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/fast/editing/editing-position-crash-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/fast/editing/editing-position-crash-expected.txt	2022-01-20 01:27:25 UTC (rev 288258)
@@ -0,0 +1,3 @@
+
+PASS if this doesn't crash
+

Added: releases/WebKitGTK/webkit-2.34/LayoutTests/fast/editing/editing-position-crash.html (0 => 288258)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/fast/editing/editing-position-crash.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/fast/editing/editing-position-crash.html	2022-01-20 01:27:25 UTC (rev 288258)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+_onload_ = () => {
+  document.designMode = "on";
+  path0 = document.getElementById('path0');
+  path0.focus();
+  if (window.testRunner)
+    testRunner.dumpAsText();
+}
+function insert() {
+  document.execCommand("insertHorizontalRule", false, null);
+  window.addEventListener("beforeinput", delfn, { capture: true, once: true });
+  document.execCommand("createLink", false, "x");
+}
+function delfn() {
+  document.execCommand("delete", false, null);
+}
+</script>
+</head>
+<body>
+<svg _onfocusin_="insert()">
+<path id="path0" tabindex="2" _onfocusin_="window.getSelection().setPosition(obj0, 10);" />
+</svg>
+<br />
+<object id="obj0" data="" type="image/jpeg">
+PASS if this doesn't crash
+</object>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog (288257 => 288258)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog	2022-01-20 01:22:03 UTC (rev 288257)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog	2022-01-20 01:27:25 UTC (rev 288258)
@@ -1,3 +1,18 @@
+2021-11-15  Gabriel Nava Marino  <[email protected]>
+
+        nullptr deref in CompositeEditCommand::insertNodeAt
+        https://bugs.webkit.org/show_bug.cgi?id=232837
+
+        Reviewed by Wenson Hsieh and Darin Adler.
+
+        Check endingSelection is not orphan before inserting nodes at
+        the start position.
+
+        Test: fast/editing/editing-position-crash.html
+
+        * editing/CreateLinkCommand.cpp:
+        (WebCore::CreateLinkCommand::doApply):
+
 2021-11-03  Rob Buis  <[email protected]>
 
         Return nullopt in aspect-ratio+intrinsic width case

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/editing/CreateLinkCommand.cpp (288257 => 288258)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/editing/CreateLinkCommand.cpp	2022-01-20 01:22:03 UTC (rev 288257)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/editing/CreateLinkCommand.cpp	2022-01-20 01:27:25 UTC (rev 288258)
@@ -40,9 +40,9 @@
 
 void CreateLinkCommand::doApply()
 {
-    if (endingSelection().isNone())
+    if (endingSelection().isNoneOrOrphaned())
         return;
-        
+
     auto anchorElement = HTMLAnchorElement::create(document());
     anchorElement->setHref(m_url);
     
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to