Bug 208945

Summary: [macOS] Crash under WebKit::WebProcessPool::platformInitialize()
Product: WebKit Reporter: Per Arne Vollan <pvollan>
Component: WebKit Misc.Assignee: Per Arne Vollan <pvollan>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, bfulgham, cdumez, cmarcelo, ews-watchlist, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
bfulgham: review+
Patch
thorton: review+
Patch none

Description Per Arne Vollan 2020-03-11 14:05:59 PDT
Fix null pointer crash on macOS under WebKit::WebProcessPool::platformInitialize().
Comment 1 Per Arne Vollan 2020-03-11 14:06:14 PDT
rdar://problem/60330751
Comment 2 Per Arne Vollan 2020-03-11 14:12:13 PDT
Created attachment 393287 [details]
Patch
Comment 3 Brent Fulgham 2020-03-11 14:19:36 PDT
Comment on attachment 393287 [details]
Patch

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

r=me

> Source/WTF/wtf/cocoa/SoftLinking.h:53
> +}

I am shocked this doesn't already exist -- but it doesn't!

> Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:702
> +        [[NSNotificationCenter defaultCenter] removeObserver:m_accessibilityEnabledObserver.get()];

Isn't it okay to remove nil objects? I can't remember (though of course, some containers blow up if you use nil things so maybe this is one of those cases).
Comment 4 Per Arne Vollan 2020-03-11 14:25:58 PDT
Committed r258284: <https://trac.webkit.org/changeset/258284/webkit>
Comment 5 Per Arne Vollan 2020-03-11 14:31:25 PDT
(In reply to Brent Fulgham from comment #3)
> Comment on attachment 393287 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=393287&action=review
> 
> r=me
> 
> > Source/WTF/wtf/cocoa/SoftLinking.h:53
> > +}
> 
> I am shocked this doesn't already exist -- but it doesn't!
> 
> > Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:702
> > +        [[NSNotificationCenter defaultCenter] removeObserver:m_accessibilityEnabledObserver.get()];
> 
> Isn't it okay to remove nil objects? I can't remember (though of course,
> some containers blow up if you use nil things so maybe this is one of those
> cases).

I believe the null check is needed.

Thanks for reviewing!
Comment 6 Per Arne Vollan 2020-03-11 14:56:02 PDT
Reopening to attach new patch.
Comment 7 Per Arne Vollan 2020-03-11 14:56:03 PDT
Created attachment 393291 [details]
Patch
Comment 8 Brent Fulgham 2020-03-11 14:58:47 PDT
Comment on attachment 393291 [details]
Patch

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

Looks like Tim already got it, but r=me, too!

> Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:458
> +    if (libAccessibilityLibrary() && _AXSApplicationAccessibilityEnabled()) {

Oops!
Comment 9 Per Arne Vollan 2020-03-11 15:17:34 PDT
Created attachment 393292 [details]
Patch
Comment 10 Per Arne Vollan 2020-03-11 15:19:06 PDT
Committed unreviewed build fix: <https://trac.webkit.org/changeset/258289/webkit>