[vlc-commits] [Git][videolan/vlc][master] macosx: fix possible SPMediaKeyTap crash

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Tue Nov 8 11:41:43 UTC 2022



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
41ec80a1 by Marvin Scholz at 2022-11-08T11:27:21+00:00
macosx: fix possible SPMediaKeyTap crash

Adding nil to an NSArray would make it raise an
NSInvalidArgumentException which in turn leads to an abort in
dispatch_once:
  https://github.com/apple-oss-distributions/libdispatch/blob/55c3a68e9ec47f1c1d5bb9909404ce5f0351edef/src/object.m#L557

Fix #27487

- - - - -


1 changed file:

- modules/gui/macosx/imported/SPMediaKeyTap/SPMediaKeyTap.m


Changes:

=====================================
modules/gui/macosx/imported/SPMediaKeyTap/SPMediaKeyTap.m
=====================================
@@ -173,8 +173,13 @@ static CGEventRef tapEventCallback(CGEventTapProxy proxy, CGEventType type, CGEv
     static NSArray *bundleIdentifiers;
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
+        NSString *ourIdentifier = [[NSBundle mainBundle] bundleIdentifier];
+        if (ourIdentifier == nil) {
+            NSLog(@"SPMediaKeyTap: Bundle identifier unexpectedly nil, falling back to org.videolan.vlc");
+            ourIdentifier = @"org.videolan.vlc";
+        }
         bundleIdentifiers = @[
-            [[NSBundle mainBundle] bundleIdentifier], // your app
+            ourIdentifier, // your app
             @"com.spotify.client",
             @"com.apple.iTunes",
             @"com.apple.Music",



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/41ec80a1282ba01d82e7954530e1d9ab8e14e415

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/41ec80a1282ba01d82e7954530e1d9ab8e14e415
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list