[vlc-devel] [PATCH 1/5] macosx: fix potential null deref in prefs tree construction

Lyndon Brown jnqnfe at gmail.com
Thu Sep 24 01:09:58 CEST 2020


From: Lyndon Brown <jnqnfe at gmail.com>
Date: Thu, 25 Apr 2019 04:11:43 +0100
Subject: macosx: fix potential null deref in prefs tree construction

subCategoryItem would be null if:
 a) a plugin author neglected to place a set_category() call before one
    or more options.
 b) the first or only subcat targetted by a plugin is a general one

there are actual examples of A with a handful of in-tree plugins (to be
fixed in a subsequent commit). i don't have a mac; did it not crash
before this fix?

there are multiple in-tree modules which target general subcats,
including various logger and keystore plugins. again, did this not
cause it to crash?

diff --git a/modules/gui/macosx/preferences/prefs.m b/modules/gui/macosx/preferences/prefs.m
index f74afc9752..a8847e7189 100644
--- a/modules/gui/macosx/preferences/prefs.m
+++ b/modules/gui/macosx/preferences/prefs.m
@@ -535,7 +535,7 @@
                 }
             }
             else if (!module_is_main(p_module) && (CONFIG_ITEM(configType) || configType == CONFIG_SECTION)) {
-                if (![[subCategoryItem children] containsObject: pluginItem]) {
+                if (subCategoryItem && ![[subCategoryItem children] containsObject: pluginItem]) {
                     [[subCategoryItem children] addObject:pluginItem];
                 }
 



More information about the vlc-devel mailing list