RESOLVED FIXED 210683
[IPC hardening] Use MESSAGE_CHECK in WebPageProxy::loadRecentSearches() and WebPageProxy::saveRecentSearches()
https://bugs.webkit.org/show_bug.cgi?id=210683
Summary [IPC hardening] Use MESSAGE_CHECK in WebPageProxy::loadRecentSearches() and W...
David Kilzer (:ddkilzer)
Reported 2020-04-17 21:02:48 PDT
Use MESSAGE_CHECK in WebPageProxy::loadRecentSearches() and WebPageProxy::saveRecentSearches(). <rdar://problem/59240446>
Attachments
Patch v1 (3.01 KB, patch)
2020-04-17 21:07 PDT, David Kilzer (:ddkilzer)
no flags
David Kilzer (:ddkilzer)
Comment 1 2020-04-17 21:07:44 PDT
Created attachment 396830 [details] Patch v1
David Kilzer (:ddkilzer)
Comment 2 2020-04-18 09:20:10 PDT
Comment on attachment 396830 [details] Patch v1 View in context: https://bugs.webkit.org/attachment.cgi?id=396830&action=review > Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:73 > - if (!name) { > - // FIXME: This should be a message check. > - return; > - } > + MESSAGE_CHECK(!name.isNull()); We could also write this like so: MESSAGE_CHECK(!!name); I'm not sure if that is easier to read that !name.isNull().
Geoffrey Garen
Comment 3 2020-04-19 12:15:03 PDT
Comment on attachment 396830 [details] Patch v1 r=me My preference is the "!name.isNull()" style. I think it reads more clearly. Also, "!!" is kind of mind-bending if you haven't seen it before. I believe that the "!!" style originated, especially on Windows, to work around a missing feature in C++ (a safe way to convert to boolean without converting to integer by accident). You can see vestigial remnants of the same issue in WebKit's uses of "UnspecifiedBoolType" (which is even more mind-bending). See also http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2333.html. In the modern C++ world, where operator bool can be made explicit, I believe there is no need to use "!!" anymore.
EWS
Comment 4 2020-04-19 19:18:38 PDT
Committed r260347: <https://trac.webkit.org/changeset/260347> All reviewed patches have been landed. Closing bug and clearing flags on attachment 396830 [details].
Note You need to log in before you can comment on or make changes to this bug.