Title: [136208] trunk/Source/WebKit2
Revision
136208
Author
[email protected]
Date
2012-11-29 23:58:33 -0800 (Thu, 29 Nov 2012)

Log Message

PDFPlugin: Only plain text can be copied out of PDFs
https://bugs.webkit.org/show_bug.cgi?id=103591
<rdar://problem/12555161>

Reviewed by Alexey Proskuryakov.

Don't write zero-length data to the pasteboard, just skip the item.

As mentioned in the comment, we don't expect this to come up, and would like to know if it does,
so we assert that it doesn't happen in debug builds.

* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::writeItemsToPasteboard):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (136207 => 136208)


--- trunk/Source/WebKit2/ChangeLog	2012-11-30 06:41:40 UTC (rev 136207)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-30 07:58:33 UTC (rev 136208)
@@ -1,3 +1,19 @@
+2012-11-29  Tim Horton  <[email protected]>
+
+        PDFPlugin: Only plain text can be copied out of PDFs
+        https://bugs.webkit.org/show_bug.cgi?id=103591
+        <rdar://problem/12555161>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Don't write zero-length data to the pasteboard, just skip the item.
+
+        As mentioned in the comment, we don't expect this to come up, and would like to know if it does,
+        so we assert that it doesn't happen in debug builds.
+
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::writeItemsToPasteboard):
+
 2012-11-29  Martin Robinson  <[email protected]>
 
         [GTK] [WebKit2] WebKitWebViewBase creates a GL context for the redirected XComposite window crashing WebKit in Xvfb

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm (136207 => 136208)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2012-11-30 06:41:40 UTC (rev 136207)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2012-11-30 07:58:33 UTC (rev 136208)
@@ -772,6 +772,12 @@
         NSString *type = [types objectAtIndex:i];
         NSData *data = "" objectAtIndex:i];
 
+        // We don't expect the data for any items to be empty, but aren't completely sure.
+        // Avoid crashing in the SharedMemory constructor in release builds if we're wrong.
+        ASSERT(data.length);
+        if (!data.length)
+            continue;
+
         if ([type isEqualToString:NSStringPboardType] || [type isEqualToString:NSPasteboardTypeString]) {
             RetainPtr<NSString> plainTextString(AdoptNS, [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
             WebProcess::shared().connection()->send(Messages::WebContext::SetPasteboardStringForType(NSGeneralPboard, type, plainTextString.get()), 0);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to