Bug 184090 - Avoid uninitialized mach ports
Summary: Avoid uninitialized mach ports
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: Brent Fulgham
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-03-28 09:20 PDT by Brent Fulgham
Modified: 2018-03-28 11:07 PDT (History)
13 users (show)

See Also:


Attachments
Patch (42.79 KB, patch)
2018-03-28 09:48 PDT, Brent Fulgham
cdumez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2018-03-28 09:20:47 PDT
It is possible for mach_port_allocate to return an error, but we rarely check its return value. The value of the argument passed to mach_port_allocate is not guaranteed to be valid when it returns an error, so there is a potential for us to try to use invalid ports.

We should always check return values, and ensure that the mach port variables we seek to initialize are kept in a valid state.

While we're at it, we should add some additional assertions to confirm we aren't dealing with invalid ports.
Comment 1 Brent Fulgham 2018-03-28 09:37:40 PDT
<rdar://problem/37261129>
Comment 2 Brent Fulgham 2018-03-28 09:48:40 PDT
Created attachment 336666 [details]
Patch
Comment 3 Chris Dumez 2018-03-28 10:00:58 PDT
Comment on attachment 336666 [details]
Patch

r=me if the bots are happy.
Comment 4 Brent Fulgham 2018-03-28 11:07:02 PDT
Committed r230035: <https://trac.webkit.org/changeset/230035>