Title: [248054] branches/safari-608-branch/Source/WebKit

Diff

Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (248053 => 248054)


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-07-31 20:54:18 UTC (rev 248053)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-07-31 20:56:03 UTC (rev 248054)
@@ -1,3 +1,24 @@
+2019-07-31  Alan Coon  <[email protected]>
+
+        Apply patch. rdar://problem/53764240
+
+    2019-07-31  Ryosuke Niwa  <[email protected]>
+
+            Add a missing null check to ShareableBitmap::makeCGImageCopy()
+            https://bugs.webkit.org/show_bug.cgi?id=200184
+
+            Reviewed by Wenson Hsieh.
+
+            Added a null check to makeCGImageCopy to when either GraphicsContext or its platform context is null.
+            Added the same platform context null check to convertImageToBitmap and convertCGImageToBitmap
+            since the crash intendeed to be fixed in r247134 is still happening.
+
+            * Shared/cg/ShareableBitmapCG.cpp:
+            (WebKit::ShareableBitmap::makeCGImageCopy):
+            * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
+            (WebKit::convertImageToBitmap):
+            (WebKit::convertCGImageToBitmap):
+
 2019-07-29  Alan Coon  <[email protected]>
 
         Cherry-pick r247823. rdar://problem/53449739

Modified: branches/safari-608-branch/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp (248053 => 248054)


--- branches/safari-608-branch/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp	2019-07-31 20:54:18 UTC (rev 248053)
+++ branches/safari-608-branch/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp	2019-07-31 20:56:03 UTC (rev 248054)
@@ -114,6 +114,9 @@
 RetainPtr<CGImageRef> ShareableBitmap::makeCGImageCopy()
 {
     auto graphicsContext = createGraphicsContext();
+    if (!graphicsContext || !graphicsContext->hasPlatformContext())
+        return nullptr;
+
     RetainPtr<CGImageRef> image = adoptCF(CGBitmapContextCreateImage(graphicsContext->platformContext()));
     return image;
 }

Modified: branches/safari-608-branch/Source/WebKit/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm (248053 => 248054)


--- branches/safari-608-branch/Source/WebKit/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm	2019-07-31 20:54:18 UTC (rev 248053)
+++ branches/safari-608-branch/Source/WebKit/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm	2019-07-31 20:56:03 UTC (rev 248054)
@@ -69,7 +69,7 @@
         return nullptr;
 
     auto graphicsContext = bitmap->createGraphicsContext();
-    if (!graphicsContext)
+    if (!graphicsContext || !graphicsContext->hasPlatformContext())
         return nullptr;
 
     RetainPtr<NSGraphicsContext> savedContext = [NSGraphicsContext currentContext];
@@ -184,6 +184,8 @@
         return nullptr;
 
     auto graphicsContext = bitmap->createGraphicsContext();
+    if (!graphicsContext || !graphicsContext->hasPlatformContext())
+        return nullptr;
     UIGraphicsPushContext(graphicsContext->platformContext());
     CGContextDrawImage(graphicsContext->platformContext(), CGRectMake(0, 0, size.width(), size.height()), image);
     UIGraphicsPopContext();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to