Title: [288960] trunk/Source/WebCore
Revision
288960
Author
[email protected]
Date
2022-02-02 10:10:50 -0800 (Wed, 02 Feb 2022)

Log Message

null ptr deref in Editor::pasteWithPasteboard
https://bugs.webkit.org/show_bug.cgi?id=235966

Patch by Gabriel Nava Marino <[email protected]> on 2022-02-02
Reviewed by Wenson Hsieh.

Add an additional check as pasteAsFragment's dispatchEvent can end up removing the client.

No new tests due to requiring Node web server (and cannot reproduce in LayoutTests/http/tests).

* editing/mac/EditorMac.mm:
(WebCore::Editor::pasteWithPasteboard):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (288959 => 288960)


--- trunk/Source/WebCore/ChangeLog	2022-02-02 18:05:11 UTC (rev 288959)
+++ trunk/Source/WebCore/ChangeLog	2022-02-02 18:10:50 UTC (rev 288960)
@@ -1,3 +1,17 @@
+2022-02-02  Gabriel Nava Marino  <[email protected]>
+
+        null ptr deref in Editor::pasteWithPasteboard
+        https://bugs.webkit.org/show_bug.cgi?id=235966
+
+        Reviewed by Wenson Hsieh.
+
+        Add an additional check as pasteAsFragment's dispatchEvent can end up removing the client.
+
+        No new tests due to requiring Node web server (and cannot reproduce in LayoutTests/http/tests).
+
+        * editing/mac/EditorMac.mm:
+        (WebCore::Editor::pasteWithPasteboard):
+
 2022-02-02  Commit Queue  <[email protected]>
 
         Unreviewed, reverting r286988.

Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (288959 => 288960)


--- trunk/Source/WebCore/editing/mac/EditorMac.mm	2022-02-02 18:05:11 UTC (rev 288959)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm	2022-02-02 18:10:50 UTC (rev 288960)
@@ -102,8 +102,9 @@
 
     if (fragment && shouldInsertFragment(*fragment, range, EditorInsertAction::Pasted))
         pasteAsFragment(fragment.releaseNonNull(), canSmartReplaceWithPasteboard(*pasteboard), false, options.contains(PasteOption::IgnoreMailBlockquote) ? MailBlockquoteHandling::IgnoreBlockquote : MailBlockquoteHandling::RespectBlockquote );
-
-    client()->setInsertionPasteboard(String());
+    
+    if (auto* client = this->client())
+        client->setInsertionPasteboard(String());
 }
 
 void Editor::platformCopyFont()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to