[vlc-commits] [Git][videolan/vlc][3.0.x] macosx: fix possible SPMediaKeyTap crash

David (@dfuhrmann) gitlab at videolan.org
Sun Nov 27 21:09:25 UTC 2022



David pushed to branch 3.0.x at VideoLAN / VLC


Commits:
b64b9c22 by Marvin Scholz at 2022-11-27T20:54:08+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

(cherry picked from commit 41ec80a1282ba01d82e7954530e1d9ab8e14e415)
Signed-off-by: Marvin Scholz <epirat07 at gmail.com>

- - - - -


1 changed file:

- modules/gui/macosx/SPMediaKeyTap.m


Changes:

=====================================
modules/gui/macosx/SPMediaKeyTap.m
=====================================
@@ -157,8 +157,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/b64b9c224bc69e5a2803c7cdbe8d83a65303cf15

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/b64b9c224bc69e5a2803c7cdbe8d83a65303cf15
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