[vlc-commits] [Git][videolan/vlc][master] macosx: VLCInputItem: handle NULL psz_path

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Feb 25 09:29:56 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
5ef997df by Alexandre Janniaux at 2023-02-25T09:03:22+00:00
macosx: VLCInputItem: handle NULL psz_path

With a mock URL like mock://video_track_count=1;video_chroma=I411,
vlc_uri2path will return a NULL string because the demux is not matching
with any file. It leads to an empty NSString which result in a crash in
the end.

Fix #27884

- - - - -


1 changed file:

- modules/gui/macosx/library/VLCInputItem.m


Changes:

=====================================
modules/gui/macosx/library/VLCInputItem.m
=====================================
@@ -599,18 +599,18 @@ static const struct input_preparser_callbacks_t preparseCallbacks = {
         char *psz_url = input_item_GetURI(_vlcInputItem);
         if (psz_url) {
             char *psz_path = vlc_uri2path(psz_url);
-            NSString *path = toNSStr(psz_path);
-
-            free(psz_url);
-            free(psz_path);
-
-            image = [NSImage quickLookPreviewForLocalPath:path
-                                                 withSize:size];
-
-            if (!image) {
-                image = [[NSWorkspace sharedWorkspace] iconForFile:path];
-                image.size = size;
+            if (psz_path) {
+                NSString *path = toNSStr(psz_path);
+                free(psz_path);
+                image = [NSImage quickLookPreviewForLocalPath:path
+                                                     withSize:size];
+
+                if (!image) {
+                    image = [[NSWorkspace sharedWorkspace] iconForFile:path];
+                    image.size = size;
+                }
             }
+            free(psz_url);
         }
     }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5ef997df7d10650c98bfa1658d03600e895fd84b

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