Title: [144483] trunk/Source/WebCore
- Revision
- 144483
- Author
- [email protected]
- Date
- 2013-03-01 12:43:00 -0800 (Fri, 01 Mar 2013)
Log Message
Crash at WebCore::SharedBuffer::hasPlatformData writing an image to the pasteboard.
https://bugs.webkit.org/show_bug.cgi?id=111211.
<rdar://problem/8772758>
Reviewed by Ryosuke Niwa.
This is a speculative fix since we don't have a solid repro case.
Adding null check every time we build a SharedBuffer from an NSData
we have obtained manipulating data from the pasteboard.
* platform/mac/PasteboardMac.mm:
(WebCore::writeFileWrapperAsRTFDAttachment):
(WebCore::Pasteboard::writeImage):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (144482 => 144483)
--- trunk/Source/WebCore/ChangeLog 2013-03-01 20:42:07 UTC (rev 144482)
+++ trunk/Source/WebCore/ChangeLog 2013-03-01 20:43:00 UTC (rev 144483)
@@ -1,5 +1,21 @@
2013-03-01 Enrica Casucci <[email protected]>
+ Crash at WebCore::SharedBuffer::hasPlatformData writing an image to the pasteboard.
+ https://bugs.webkit.org/show_bug.cgi?id=111211.
+ <rdar://problem/8772758>
+
+ Reviewed by Ryosuke Niwa.
+
+ This is a speculative fix since we don't have a solid repro case.
+ Adding null check every time we build a SharedBuffer from an NSData
+ we have obtained manipulating data from the pasteboard.
+
+ * platform/mac/PasteboardMac.mm:
+ (WebCore::writeFileWrapperAsRTFDAttachment):
+ (WebCore::Pasteboard::writeImage):
+
+2013-03-01 Enrica Casucci <[email protected]>
+
Crash at WebCore::SharedBuffer::hasPlatformData during paste.
https://bugs.webkit.org/show_bug.cgi?id=111207.
<rdar://problem/13024528>
Modified: trunk/Source/WebCore/platform/mac/PasteboardMac.mm (144482 => 144483)
--- trunk/Source/WebCore/platform/mac/PasteboardMac.mm 2013-03-01 20:42:07 UTC (rev 144482)
+++ trunk/Source/WebCore/platform/mac/PasteboardMac.mm 2013-03-01 20:43:00 UTC (rev 144483)
@@ -289,7 +289,8 @@
[attachment release];
NSData *RTFDData = [string RTFDFromRange:NSMakeRange(0, [string length]) documentAttributes:nil];
- platformStrategies()->pasteboardStrategy()->setBufferForType(SharedBuffer::wrapNSData((NSData *)RTFDData).get(), NSRTFDPboardType, pasteboardName);
+ if (RTFDData)
+ platformStrategies()->pasteboardStrategy()->setBufferForType(SharedBuffer::wrapNSData(RTFDData).get(), NSRTFDPboardType, pasteboardName);
}
void Pasteboard::writeImage(Node* node, const KURL& url, const String& title)
@@ -310,9 +311,12 @@
writeURLForTypes(writableTypesForImage(), m_pasteboardName, cocoaURL, nsStringNilIfEmpty(title), node->document()->frame());
Image* image = cachedImage->imageForRenderer(renderer);
- ASSERT(image);
-
- platformStrategies()->pasteboardStrategy()->setBufferForType(SharedBuffer::wrapNSData((NSData *)[image->getNSImage() TIFFRepresentation]), NSTIFFPboardType, m_pasteboardName);
+ if (!image)
+ return;
+ NSData *imageData = (NSData *)[image->getNSImage() TIFFRepresentation];
+ if (!imageData)
+ return;
+ platformStrategies()->pasteboardStrategy()->setBufferForType(SharedBuffer::wrapNSData(imageData), NSTIFFPboardType, m_pasteboardName);
String MIMEType = cachedImage->response().mimeType();
ASSERT(MIMETypeRegistry::isSupportedImageResourceMIMEType(MIMEType));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes