Bug 209981 - [Cocoa] Update MESSAGE_CHECK macros used in WebProcessProxy::didCreateSleepDisabler/WebProcessProxy::didDestroySleepDisabler
Summary: [Cocoa] Update MESSAGE_CHECK macros used in WebProcessProxy::didCreateSleepDi...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on: 209676
Blocks:
  Show dependency treegraph
 
Reported: 2020-04-03 12:33 PDT by David Kilzer (:ddkilzer)
Modified: 2020-04-03 13:19 PDT (History)
5 users (show)

See Also:


Attachments
Patch v1 (2.11 KB, patch)
2020-04-03 12:38 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2020-04-03 12:33:57 PDT
Update MESSAGE_CHECK macros used in WebProcessProxy::didCreateSleepDisabler/WebProcessProxy::didDestroySleepDisabler.

<rdar://problem/61237674>
Comment 1 David Kilzer (:ddkilzer) 2020-04-03 12:38:03 PDT
Created attachment 395402 [details]
Patch v1
Comment 2 Darin Adler 2020-04-03 13:10:50 PDT
Comment on attachment 395402 [details]
Patch v1

So decoding always checks for both invalid hash table values for identifiers?
Comment 3 Darin Adler 2020-04-03 13:11:32 PDT
Comment on attachment 395402 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=395402&action=review

> Source/WebKit/ChangeLog:12
> +        - Remove MESSAGE_CHECK for `identifier` since decoding detects
> +          invalid values.

Both the empty and deleted values for identifiers as hash table keys are prohibited/checked?
Comment 4 EWS 2020-04-03 13:13:46 PDT
Committed r259505: <https://trac.webkit.org/changeset/259505>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 395402 [details].
Comment 5 Geoffrey Garen 2020-04-03 13:19:27 PDT
> > Source/WebKit/ChangeLog:12
> > +        - Remove MESSAGE_CHECK for `identifier` since decoding detects
> > +          invalid values.
> 
> Both the empty and deleted values for identifiers as hash table keys are
> prohibited/checked?

Looks like it:

    template<typename Decoder> static Optional<ObjectIdentifier> decode(Decoder& decoder)
    {
        Optional<uint64_t> identifier;
        decoder >> identifier;
        if (!identifier || !isValidIdentifier(*identifier))
            return WTF::nullopt;
        return ObjectIdentifier { *identifier };
    }

    static bool isValidIdentifier(uint64_t identifier) { return identifier && identifier != hashTableDeletedValue(); }