Title: [234727] tags/Safari-607.1.2/Source/WebCore
Revision
234727
Author
[email protected]
Date
2018-08-09 10:47:24 -0700 (Thu, 09 Aug 2018)

Log Message

Cherry-pick r234717. rdar://problem/43075662

    Prevent collectScreenProperties from crashing Base System
    https://bugs.webkit.org/show_bug.cgi?id=188429
    <rdar://problem/43075662>

    Patch by Justin Fan <[email protected]> on 2018-08-08
    Reviewed by Simon Fraser.

    Adding some error-checking and early returns to further prevent calling CGLDescribeRenderer with invalid parameters.

    Existing WebGL tests should cover; no expected change in behavior. Crash happened primarily on Base System.

    * platform/mac/PlatformScreenMac.mm:
    (WebCore::gpuIDForDisplayMask):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234717 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: tags/Safari-607.1.2/Source/WebCore/ChangeLog (234726 => 234727)


--- tags/Safari-607.1.2/Source/WebCore/ChangeLog	2018-08-09 17:24:39 UTC (rev 234726)
+++ tags/Safari-607.1.2/Source/WebCore/ChangeLog	2018-08-09 17:47:24 UTC (rev 234727)
@@ -1,3 +1,38 @@
+2018-08-09  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r234717. rdar://problem/43075662
+
+    Prevent collectScreenProperties from crashing Base System
+    https://bugs.webkit.org/show_bug.cgi?id=188429
+    <rdar://problem/43075662>
+    
+    Patch by Justin Fan <[email protected]> on 2018-08-08
+    Reviewed by Simon Fraser.
+    
+    Adding some error-checking and early returns to further prevent calling CGLDescribeRenderer with invalid parameters.
+    
+    Existing WebGL tests should cover; no expected change in behavior. Crash happened primarily on Base System.
+    
+    * platform/mac/PlatformScreenMac.mm:
+    (WebCore::gpuIDForDisplayMask):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234717 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-08-08  Justin Fan  <[email protected]>
+
+            Prevent collectScreenProperties from crashing Base System
+            https://bugs.webkit.org/show_bug.cgi?id=188429
+            <rdar://problem/43075662>
+
+            Reviewed by Simon Fraser.
+
+            Adding some error-checking and early returns to further prevent calling CGLDescribeRenderer with invalid parameters.
+
+            Existing WebGL tests should cover; no expected change in behavior. Crash happened primarily on Base System.
+
+            * platform/mac/PlatformScreenMac.mm:
+            (WebCore::gpuIDForDisplayMask):
+
 2018-08-07  Chris Dumez  <[email protected]>
 
         navigator.sendBeacon does not work in pagehide callbacks

Modified: tags/Safari-607.1.2/Source/WebCore/platform/mac/PlatformScreenMac.mm (234726 => 234727)


--- tags/Safari-607.1.2/Source/WebCore/platform/mac/PlatformScreenMac.mm	2018-08-09 17:24:39 UTC (rev 234726)
+++ tags/Safari-607.1.2/Source/WebCore/platform/mac/PlatformScreenMac.mm	2018-08-09 17:47:24 UTC (rev 234727)
@@ -200,24 +200,28 @@
 
 IORegistryGPUID gpuIDForDisplayMask(GLuint displayMask)
 {
-    GLint numRenderers;
-    CGLRendererInfoObj rendererInfo;
+    GLint numRenderers = 0;
+    CGLRendererInfoObj rendererInfo = nullptr;
     CGLError error = CGLQueryRendererInfo(displayMask, &rendererInfo, &numRenderers);
-    ASSERT(error == kCGLNoError);
+    if (!numRenderers || !rendererInfo || error != kCGLNoError)
+        return 0;
 
     // The 0th renderer should not be the software renderer.
     GLint isAccelerated;
     error = CGLDescribeRenderer(rendererInfo, 0, kCGLRPAccelerated, &isAccelerated);
-    ASSERT(error == kCGLNoError);
-    ASSERT(isAccelerated);
+    if (!isAccelerated || error != kCGLNoError)
+        return 0;
 
-    GLint gpuIDLow;
-    GLint gpuIDHigh;
+    GLint gpuIDLow = 0;
+    GLint gpuIDHigh = 0;
 
     error = CGLDescribeRenderer(rendererInfo, 0, kCGLRPRegistryIDLow, &gpuIDLow);
-    ASSERT(error == kCGLNoError);
+    if (error != kCGLNoError)
+        return 0;
+
     error = CGLDescribeRenderer(rendererInfo, 0, kCGLRPRegistryIDHigh, &gpuIDHigh);
-    ASSERT(error == kCGLNoError);
+    if (error != kCGLNoError)
+        return 0;
 
     return (IORegistryGPUID) gpuIDHigh << 32 | gpuIDLow;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to