Title: [260347] trunk/Source/WebKit
Revision
260347
Author
[email protected]
Date
2020-04-19 19:18:32 -0700 (Sun, 19 Apr 2020)

Log Message

[IPC hardening] Use MESSAGE_CHECK in WebPageProxy::loadRecentSearches() and WebPageProxy::saveRecentSearches()
<https://webkit.org/b/210683>
<rdar://problem/59240446>

Reviewed by Geoffrey Garen.

* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(MESSAGE_CHECK): Add.
(MESSAGE_CHECK_COMPLETION): Add.
(WebKit::WebPageProxy::saveRecentSearches):
(WebKit::WebPageProxy::loadRecentSearches):
- Replace boolean check of const String& with MESSAGE_CHECK.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (260346 => 260347)


--- trunk/Source/WebKit/ChangeLog	2020-04-20 01:56:24 UTC (rev 260346)
+++ trunk/Source/WebKit/ChangeLog	2020-04-20 02:18:32 UTC (rev 260347)
@@ -1,3 +1,18 @@
+2020-04-19  David Kilzer  <[email protected]>
+
+        [IPC hardening] Use MESSAGE_CHECK in WebPageProxy::loadRecentSearches() and WebPageProxy::saveRecentSearches()
+        <https://webkit.org/b/210683>
+        <rdar://problem/59240446>
+
+        Reviewed by Geoffrey Garen.
+
+        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+        (MESSAGE_CHECK): Add.
+        (MESSAGE_CHECK_COMPLETION): Add.
+        (WebKit::WebPageProxy::saveRecentSearches):
+        (WebKit::WebPageProxy::loadRecentSearches):
+        - Replace boolean check of const String& with MESSAGE_CHECK.
+
 2020-04-18  Darin Adler  <[email protected]>
 
         Update header postprocessing version cutoff to keep Apple internal builds working

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (260346 => 260347)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2020-04-20 01:56:24 UTC (rev 260346)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2020-04-20 02:18:32 UTC (rev 260347)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2020 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,6 +28,7 @@
 
 #import "APIAttachment.h"
 #import "APIUIClient.h"
+#import "Connection.h"
 #import "DataDetectionResult.h"
 #import "InsertTextOptions.h"
 #import "LoadParameters.h"
@@ -54,6 +55,9 @@
 #include "MediaUsageManagerCocoa.h"
 #endif
 
+#define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, process().connection())
+#define MESSAGE_CHECK_COMPLETION(assertion, completion) MESSAGE_CHECK_COMPLETION_BASE(assertion, process().connection(), completion)
+
 namespace WebKit {
 using namespace WebCore;
 
@@ -66,10 +70,7 @@
 
 void WebPageProxy::saveRecentSearches(const String& name, const Vector<WebCore::RecentSearch>& searchItems)
 {
-    if (!name) {
-        // FIXME: This should be a message check.
-        return;
-    }
+    MESSAGE_CHECK(!name.isNull());
 
     WebCore::saveRecentSearches(name, searchItems);
 }
@@ -76,10 +77,7 @@
 
 void WebPageProxy::loadRecentSearches(const String& name, CompletionHandler<void(Vector<WebCore::RecentSearch>&&)>&& completionHandler)
 {
-    if (!name) {
-        // FIXME: This should be a message check.
-        return completionHandler({ });
-    }
+    MESSAGE_CHECK_COMPLETION(!name.isNull(), completionHandler({ }));
 
     completionHandler(WebCore::loadRecentSearches(name));
 }
@@ -390,3 +388,6 @@
 #endif
 
 } // namespace WebKit
+
+#undef MESSAGE_CHECK_COMPLETION
+#undef MESSAGE_CHECK
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to