Skip to content

Commit

Permalink
GPUConnectionToWebProcess::setTCCIdentity need to check that it has a…
Browse files Browse the repository at this point in the history
… bundle identifier before calling tcc_identity_create

https://bugs.webkit.org/show_bug.cgi?id=271459
rdar://122836442

Reviewed by Eric Carlson.

As can be seen from crash logs, we are sometimes calling tcc_identity_create with a nullptr identifier.
This identifier is coming from the bundle proxy created by [LSBundleProxy bundleProxyWithAuditToken:error:].
This function can probably return nil without an error, or the returned bundle proxy has a nullptr identifier.
We add an if check that covers both cases and add release logging to know the exact issue.

* Source/WebKit/GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm:
(WebKit::GPUConnectionToWebProcess::setTCCIdentity):

Canonical link: https://commits.webkit.org/276549@main
  • Loading branch information
youennf committed Mar 22, 2024
1 parent 6482251 commit 9a7846e
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@
return;
}

auto identity = adoptOSObject(tcc_identity_create(TCC_IDENTITY_CODE_BUNDLE_ID, [bundleProxy.bundleIdentifier UTF8String]));
const auto* bundleIdentifier = [bundleProxy.bundleIdentifier UTF8String];
if (!bundleIdentifier) {
RELEASE_LOG_ERROR(WebRTC, "Unable to get the bundle identifier, bundle is %d", !!bundleProxy);
return;
}

auto identity = adoptOSObject(tcc_identity_create(TCC_IDENTITY_CODE_BUNDLE_ID, bundleIdentifier));
if (!identity) {
RELEASE_LOG_ERROR(WebRTC, "tcc_identity_create returned null");
return;
Expand Down

0 comments on commit 9a7846e

Please sign in to comment.