Title: [288250] releases/WebKitGTK/webkit-2.34
Revision
288250
Author
[email protected]
Date
2022-01-19 16:21:58 -0800 (Wed, 19 Jan 2022)

Log Message

Merge r284739 - Source/WebCore:
https://bugs.webkit.org/show_bug.cgi?id=232177
Check if start and end positions are still valid after updating them through mergeEndWithNextIfIdentical

Patch by Gabriel Nava Marino <[email protected]> on 2021-10-22
Reviewed by Alan Bujtas.

We currently check if start and end positions are still valid after
updating them through mergeEndWithNextIfIdentical, but not through
mergeStartWithPreviousIfIdentical. Add this check to avoid trying to
deref a nullptr in ApplyStyleCommand::mergeEndWithNextIfIdentical.

Test: fast/editing/create-link-inline-style-change-crash-001.html

* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyInlineStyle):

LayoutTests:
Check if start and end positions are still valid after updating them through mergeStartWithPreviousIfIdentical
https://bugs.webkit.org/show_bug.cgi?id=232177

Patch by Gabriel Nava Marino <[email protected]> on 2021-10-22
Reviewed by Alan Bujtas.

* fast/editing/create-link-inline-style-change-crash-001-expected.txt: Added.
* fast/editing/create-link-inline-style-change-crash-001.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.34/LayoutTests/ChangeLog (288249 => 288250)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/ChangeLog	2022-01-20 00:10:43 UTC (rev 288249)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/ChangeLog	2022-01-20 00:21:58 UTC (rev 288250)
@@ -1,3 +1,13 @@
+2021-10-22  Gabriel Nava Marino  <[email protected]>
+
+        Check if start and end positions are still valid after updating them through mergeStartWithPreviousIfIdentical
+        https://bugs.webkit.org/show_bug.cgi?id=232177
+
+        Reviewed by Alan Bujtas.
+
+        * fast/editing/create-link-inline-style-change-crash-001-expected.txt: Added.
+        * fast/editing/create-link-inline-style-change-crash-001.html: Added.
+
 2021-10-09  Rob Buis  <[email protected]>
 
         Remove scrollbars explicitly when destroying render tree

Added: releases/WebKitGTK/webkit-2.34/LayoutTests/fast/editing/create-link-inline-style-change-crash-001-expected.txt (0 => 288250)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/fast/editing/create-link-inline-style-change-crash-001-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/fast/editing/create-link-inline-style-change-crash-001-expected.txt	2022-01-20 00:21:58 UTC (rev 288250)
@@ -0,0 +1 @@
+PASS

Added: releases/WebKitGTK/webkit-2.34/LayoutTests/fast/editing/create-link-inline-style-change-crash-001.html (0 => 288250)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/fast/editing/create-link-inline-style-change-crash-001.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/fast/editing/create-link-inline-style-change-crash-001.html	2022-01-20 00:21:58 UTC (rev 288250)
@@ -0,0 +1,28 @@
+<style>
+  span {
+    display: table-cell;
+  }
+  :not(span) {
+    float: left;
+  }
+  ::first-letter {
+    width: 0;
+  }
+  :first-child {
+    -webkit-user-select: none;
+  }
+</style>
+<script>
+  _onload_ = () => {
+    document.execCommand('SelectAll');
+    document.designMode = 'on';
+    document.execCommand('InsertText', false, 'aa');
+    document.execCommand('InsertOrderedList');
+    document.execCommand('CreateLink', false, '#xyz');
+    document.execCommand('JustifyFull');
+    document.execCommand('CreateLink', false, '#');
+    document.write("PASS");
+    if (window.testRunner)
+        testRunner.dumpAsText();
+  };
+</script>

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog (288249 => 288250)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog	2022-01-20 00:10:43 UTC (rev 288249)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog	2022-01-20 00:21:58 UTC (rev 288250)
@@ -1,3 +1,20 @@
+2021-10-22  Gabriel Nava Marino  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=232177
+        Check if start and end positions are still valid after updating them through mergeEndWithNextIfIdentical
+
+        Reviewed by Alan Bujtas.
+
+        We currently check if start and end positions are still valid after
+        updating them through mergeEndWithNextIfIdentical, but not through
+        mergeStartWithPreviousIfIdentical. Add this check to avoid trying to
+        deref a nullptr in ApplyStyleCommand::mergeEndWithNextIfIdentical.
+
+        Test: fast/editing/create-link-inline-style-change-crash-001.html
+
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::applyInlineStyle):
+
 2021-10-09  Rob Buis  <[email protected]>
 
         Remove scrollbars explicitly when destroying render tree

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/editing/ApplyStyleCommand.cpp (288249 => 288250)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/editing/ApplyStyleCommand.cpp	2022-01-20 00:10:43 UTC (rev 288249)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/editing/ApplyStyleCommand.cpp	2022-01-20 00:21:58 UTC (rev 288250)
@@ -636,6 +636,9 @@
         end = endPosition();
     }
 
+    if (start.isNull() || end.isNull())
+        return;
+    
     if (splitEnd) {
         mergeEndWithNextIfIdentical(start, end);
         start = startPosition();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to