[webkit-changes] [WebKit/WebKit] 1d977e: [UnifiedPDF] Crash under UnifiedPDFPlugin::perform...

Abrar Rahman Protyasha noreply at github.com
Tue Jun 18 22:32:29 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1d977e76f609d034cf9b24a1e739d1b8988d93e6
      https://github.com/WebKit/WebKit/commit/1d977e76f609d034cf9b24a1e739d1b8988d93e6
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2024-06-18 (Tue, 18 Jun 2024)

  Changed paths:
    M Source/WebCore/plugins/PluginViewBase.h
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.h
    M Source/WebCore/testing/Internals.idl
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Source/WebKit/WebProcess/Plugins/PluginView.cpp
    M Source/WebKit/WebProcess/Plugins/PluginView.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/UnifiedPDFTests.mm

  Log Message:
  -----------
  [UnifiedPDF] Crash under UnifiedPDFPlugin::performCopyEditingOperation() when using Command-C to copy on a full frame plugin with empty selection
https://bugs.webkit.org/show_bug.cgi?id=275639
rdar://129820140

Reviewed by Wenson Hsieh and Sammy Gill.

We were crashing under performCopyEditingOperation() when trying to
build up an NSArray of pasteboard items because we failed to ensure that
one (or more) of the web archive, plain string, and HTML data
representations were nil. It is entirely possible for, say,
-[NSString dataUsingEncoding:] to return nil if the conversion is lossy.

To address this crash, we ensure each data representation we want to put
on the pasteboard is non-nil before adding them to the NSArray collecting
said items.

* Source/WebCore/plugins/PluginViewBase.h:
(WebCore::PluginViewBase::sendEditingCommandToPDFForTesting):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::sendEditingCommandToPDFForTesting const):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::performCopyEditingOperation const):
* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::sendEditingCommandToPDFForTesting):
* Source/WebKit/WebProcess/Plugins/PluginView.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/UnifiedPDFTests.mm:
(TestWebKitAPI::TEST(UnifiedPDF, CopyEditingCommandOnEmptySelectionShouldNotCrash)):

Canonical link: https://commits.webkit.org/280163@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list