Task #165 - shared-mime-info-2.3-4.fc41/scan-results.err
back to task #165download
Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/src/test-tree-magic.c: scope_hint: In function ‘parse_match_line’ shared-mime-info-2.3/src/test-tree-magic.c:119:12: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘p’ # 117| s += 2; # 118| p = strchr (s, '"'); # 119|-> *p = 0; # 120| # 121| matchlet->path = g_strdup (s); Error: COMPILER_WARNING (CWE-195): shared-mime-info-2.3/src/update-mime-database.cpp: scope_hint: In function ‘Type* get_type(const char*, GError**)’ shared-mime-info-2.3/src/update-mime-database.cpp:274:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ # 274 | for (i = 0; i < G_N_ELEMENTS(media_types); i++) # 272| (xmlChar *)"Created automatically by update-mime-database. DO NOT EDIT!")); # 273| # 274|-> for (i = 0; i < G_N_ELEMENTS(media_types); i++) # 275| { # 276| if (strcmp(media_types[i], type->media) == 0) Error: COMPILER_WARNING (CWE-195): shared-mime-info-2.3/src/update-mime-database.cpp: scope_hint: In function ‘void delete_old_types(const gchar*)’ shared-mime-info-2.3/src/update-mime-database.cpp:1961:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ # 1961 | for (i = 0; i < G_N_ELEMENTS(media_types); i++) # 1959| int i; # 1960| # 1961|-> for (i = 0; i < G_N_ELEMENTS(media_types); i++) # 1962| { # 1963| const fs::path media_dir = g_strconcat(mime_dir, "/", media_types[i], NULL); Error: COMPILER_WARNING (CWE-195): shared-mime-info-2.3/src/update-mime-database.cpp: scope_hint: In function ‘void write_namespaces(FILE*)’ shared-mime-info-2.3/src/update-mime-database.cpp:2020:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} # 2020 | for (i = 0; i < lines->len; i++) # | ~~^~~~~~~~~~~~ # 2018| g_ptr_array_sort(lines, strcmp2); # 2019| # 2020|-> for (i = 0; i < lines->len; i++) # 2021| { # 2022| char *line = (char *) lines->pdata[i]; Error: COMPILER_WARNING (CWE-195): shared-mime-info-2.3/src/update-mime-database.cpp: scope_hint: In function ‘void write_aliases(FILE*)’ shared-mime-info-2.3/src/update-mime-database.cpp:2079:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} # 2079 | for (i = 0; i < lines->len; i++) # | ~~^~~~~~~~~~~~ # 2077| g_ptr_array_sort(lines, strcmp2); # 2078| # 2079|-> for (i = 0; i < lines->len; i++) # 2080| { # 2081| char *line = (char *) lines->pdata[i]; Error: COMPILER_WARNING (CWE-195): shared-mime-info-2.3/src/update-mime-database.cpp: scope_hint: In function ‘void write_types(FILE*)’ shared-mime-info-2.3/src/update-mime-database.cpp:2110:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} # 2110 | for (i = 0; i < lines->len; i++) # | ~~^~~~~~~~~~~~ # 2108| g_ptr_array_sort(lines, strcmp2); # 2109| # 2110|-> for (i = 0; i < lines->len; i++) # 2111| { # 2112| char *line = (char *) lines->pdata[i]; Error: COMPILER_WARNING: shared-mime-info-2.3/src/update-mime-database.cpp:2161:23: warning[-Wliteral-suffix]: invalid suffix on literal; C++11 requires a space between literal and string macro # 2161 | env = "/usr/local/share/"PATH_SEPARATOR"/usr/share/"; # | ^ # 2159| env = getenv("XDG_DATA_DIRS"); # 2160| if (!env) # 2161|-> env = "/usr/local/share/"PATH_SEPARATOR"/usr/share/"; # 2162| dirs = g_strsplit(env, PATH_SEPARATOR, 0); # 2163| g_return_if_fail(dirs != NULL); Error: COMPILER_WARNING (CWE-195): shared-mime-info-2.3/src/update-mime-database.cpp: scope_hint: In function ‘gboolean write_types_cache(FILE*, GHashTable*, GHashTable*, guint*)’ shared-mime-info-2.3/src/update-mime-database.cpp:3217:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} # 3217 | for (i = 0; i < lines->len; i++) # | ~~^~~~~~~~~~~~ # 3215| return FALSE; # 3216| # 3217|-> for (i = 0; i < lines->len; i++) # 3218| { # 3219| mimetype = (char *) lines->pdata[i]; Error: COMPILER_WARNING (CWE-195): shared-mime-info-2.3/src/update-mime-database.cpp: scope_hint: In function ‘int main(int, char**)’ shared-mime-info-2.3/src/update-mime-database.cpp:3793:31: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} # 3793 | for (i = 0; i < magic_array->len; i++) # | ~~^~~~~~~~~~~~~~~~~~ # 3791| if (magic_array->len) # 3792| g_ptr_array_sort(magic_array, cmp_magic); # 3793|-> for (i = 0; i < magic_array->len; i++) # 3794| { # 3795| Magic *magic = (Magic *) magic_array->pdata[i]; Error: COMPILER_WARNING (CWE-195): shared-mime-info-2.3/src/update-mime-database.cpp:3914:31: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} # 3914 | for (i = 0; i < tree_magic_array->len; i++) # | ~~^~~~~~~~~~~~~~~~~~~~~~~ # 3912| if (tree_magic_array->len) # 3913| g_ptr_array_sort(tree_magic_array, cmp_tree_magic); # 3914|-> for (i = 0; i < tree_magic_array->len; i++) # 3915| { # 3916| TreeMagic *magic = (TreeMagic *) tree_magic_array->pdata[i]; Error: COMPILER_WARNING (CWE-697): shared-mime-info-2.3/xdgmime/src/print-mime-data.c: scope_hint: In function ‘read_from_dir’ shared-mime-info-2.3/xdgmime/src/print-mime-data.c:143:23: warning[-Waddress]: the comparison will always evaluate as ‘false’ for the address of ‘d_name’ will never be NULL # 143 | if (entry->d_name == NULL) # | ^~ /usr/include/dirent.h:61: included_from: Included from here. shared-mime-info-2.3/xdgmime/src/print-mime-data.c:17: included_from: Included from here. /usr/include/bits/dirent.h:33:10: note: ‘d_name’ declared here # 33 | char d_name[256]; /* We must not include limits.h! */ # | ^~~~~~ # 141| entry = readdir (dir); # 142| while (entry != NULL) { # 143|-> if (entry->d_name == NULL) # 144| goto next; # 145| if (strcmp (entry->d_name, ".") == 0 || Error: CLANG_WARNING: shared-mime-info-2.3/xdgmime/src/test-mime-data.c:232:4: warning[deadcode.DeadStores]: Value stored to 'end' is never read # 230| space = rest; # 231| while (*space != ' ' && *space != '\n') space++; # 232|-> end = *space; # 233| # 234| *space = '\0'; Error: CPPCHECK_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/test-mime.c:145: warning[nullPointer]: Possible null pointer dereference: expected # 143| actual = xdg_mime_get_generic_icon (mimetype); # 144| # 145|-> if (actual != expected && (actual == NULL || strcmp (actual, expected) != 0)) # 146| { # 147| printf ("Test Failed: icon of %s is %s, expected %s\n", Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/test-mime.c: scope_hint: In function ‘test_one_icon’ shared-mime-info-2.3/xdgmime/src/test-mime.c:145:48: warning[-Wanalyzer-null-argument]: use of NULL ‘expected’ where non-null expected shared-mime-info-2.3/xdgmime/src/test-mime.c:9: included_from: Included from here. /usr/include/string.h:156:12: note: argument 2 of ‘strcmp’ must be non-null # 143| actual = xdg_mime_get_generic_icon (mimetype); # 144| # 145|-> if (actual != expected && (actual == NULL || strcmp (actual, expected) != 0)) # 146| { # 147| printf ("Test Failed: icon of %s is %s, expected %s\n", Error: CLANG_WARNING: shared-mime-info-2.3/xdgmime/src/test-mime.c:145:48: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull' # 143| actual = xdg_mime_get_generic_icon (mimetype); # 144| # 145|-> if (actual != expected && (actual == NULL || strcmp (actual, expected) != 0)) # 146| { # 147| printf ("Test Failed: icon of %s is %s, expected %s\n", Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmime.c: scope_hint: In function ‘xdg_dir_time_list_add’ shared-mime-info-2.3/xdgmime/src/xdgmime.c:108:24: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘list’ shared-mime-info-2.3/xdgmime/src/xdgmime.c:30: included_from: Included from here. shared-mime-info-2.3/xdgmime/src/xdgmime.c:16: included_from: Included from here. shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimecache.h:19:55: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmime.c:141:29: note: in expansion of macro ‘_xdg_mime_cache_new_from_file’ # 106| list = calloc (1, sizeof (XdgDirTimeList)); # 107| list->checked = XDG_CHECKED_UNCHECKED; # 108|-> list->directory_name = file_name; # 109| list->mtime = mtime; # 110| list->next = dir_time_list; Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmime.c: scope_hint: In function ‘xdg_mime_init_from_directory’ shared-mime-info-2.3/xdgmime/src/xdgmime.c:138:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘file_name’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 136| # 137| file_name = malloc (strlen (directory) + strlen ("/mime.cache") + 1); # 138|-> strcpy (file_name, directory); strcat (file_name, "/mime.cache"); # 139| if (stat (file_name, &st) == 0) # 140| { Error: CPPCHECK_WARNING (CWE-401): shared-mime-info-2.3/xdgmime/src/xdgmime.c:147: error[memleakOnRealloc]: Common realloc mistake: '_caches' nulled but not freed upon failure # 145| xdg_dir_time_list_add (file_name, st.st_mtime); # 146| # 147|-> _caches = realloc (_caches, sizeof (XdgMimeCache *) * (n_caches + 2)); # 148| _caches[n_caches] = cache; # 149| _caches[n_caches + 1] = NULL; Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmime.c:158:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘file_name’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 156| # 157| file_name = malloc (strlen (directory) + strlen ("/globs2") + 1); # 158|-> strcpy (file_name, directory); strcat (file_name, "/globs2"); # 159| if (stat (file_name, &st) == 0) # 160| { Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmime.c:168:7: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘file_name’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 166| free (file_name); # 167| file_name = malloc (strlen (directory) + strlen ("/globs") + 1); # 168|-> strcpy (file_name, directory); strcat (file_name, "/globs"); # 169| if (stat (file_name, &st) == 0) # 170| { Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmime.c:181:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘file_name’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 179| # 180| file_name = malloc (strlen (directory) + strlen ("/magic") + 1); # 181|-> strcpy (file_name, directory); strcat (file_name, "/magic"); # 182| if (stat (file_name, &st) == 0) # 183| { Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmime.c:193:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘file_name’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 191| # 192| file_name = malloc (strlen (directory) + strlen ("/aliases") + 1); # 193|-> strcpy (file_name, directory); strcat (file_name, "/aliases"); # 194| _xdg_mime_alias_read_from_file (alias_list, file_name); # 195| free (file_name); Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmime.c:198:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘file_name’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 196| # 197| file_name = malloc (strlen (directory) + strlen ("/subclasses") + 1); # 198|-> strcpy (file_name, directory); strcat (file_name, "/subclasses"); # 199| _xdg_mime_parent_read_from_file (parent_list, file_name); # 200| free (file_name); Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmime.c:203:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘file_name’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 201| # 202| file_name = malloc (strlen (directory) + strlen ("/icons") + 1); # 203|-> strcpy (file_name, directory); strcat (file_name, "/icons"); # 204| _xdg_mime_icon_read_from_file (icon_list, file_name); # 205| free (file_name); Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmime.c:208:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘file_name’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 206| # 207| file_name = malloc (strlen (directory) + strlen ("/generic-icons") + 1); # 208|-> strcpy (file_name, directory); strcat (file_name, "/generic-icons"); # 209| _xdg_mime_icon_read_from_file (generic_icon_list, file_name); # 210| free (file_name); Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmime.c: scope_hint: In function ‘xdg_init_dirs’ shared-mime-info-2.3/xdgmime/src/xdgmime.c:250:7: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘mime_subdir’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 248| # 249| mime_subdir = malloc (strlen (xdg_data_home) + strlen ("/mime/") + 1); # 250|-> strcpy (mime_subdir, xdg_data_home); # 251| strcat (mime_subdir, "/mime/"); # 252| Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmime.c:253:31: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘xdg_dirs’ # 251| strcat (mime_subdir, "/mime/"); # 252| # 253|-> xdg_dirs[current_dir++] = mime_subdir; # 254| } # 255| else if (home != NULL) Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmime.c:260:7: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘guessed_xdg_home’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 258| # 259| guessed_xdg_home = malloc (strlen (home) + strlen ("/.local/share/mime/") + 1); # 260|-> strcpy (guessed_xdg_home, home); # 261| strcat (guessed_xdg_home, "/.local/share/mime/"); # 262| Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmime.c:263:31: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘xdg_dirs’ # 261| strcat (guessed_xdg_home, "/.local/share/mime/"); # 262| # 263|-> xdg_dirs[current_dir++] = guessed_xdg_home; # 264| } # 265| Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmime.c:300:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘xdg_dirs’ # 298| # 299| /* NULL terminator */ # 300|-> xdg_dirs[current_dir] = NULL; # 301| # 302| need_reread = TRUE; Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmime.c: scope_hint: In function ‘xdg_check_dir’ shared-mime-info-2.3/xdgmime/src/xdgmime.c:405:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘file_name’ where non-null expected shared-mime-info-2.3/xdgmime/src/xdgmime.h:26:34: note: in definition of macro ‘_XDG_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:24:25: note: in expansion of macro ‘_XDG_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:24:37: note: in expansion of macro ‘XDG_PREFIX’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:58:47: note: in expansion of macro ‘XDG_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmime.c:990:1: note: in expansion of macro ‘xdg_mime_get_generic_icon’ <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 403| /* Check the mime.cache file */ # 404| file_name = malloc (strlen (directory) + strlen ("/mime.cache") + 1); # 405|-> strcpy (file_name, directory); strcat (file_name, "/mime.cache"); # 406| invalid = xdg_check_file (file_name, &exists); # 407| free (file_name); Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmime.c:420:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘file_name’ where non-null expected shared-mime-info-2.3/xdgmime/src/xdgmime.h:26:34: note: in definition of macro ‘_XDG_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:24:25: note: in expansion of macro ‘_XDG_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:24:37: note: in expansion of macro ‘XDG_PREFIX’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:58:47: note: in expansion of macro ‘XDG_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmime.c:990:1: note: in expansion of macro ‘xdg_mime_get_generic_icon’ <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 418| /* Check the globs file */ # 419| file_name = malloc (strlen (directory) + strlen ("/globs") + 1); # 420|-> strcpy (file_name, directory); strcat (file_name, "/globs"); # 421| invalid = xdg_check_file (file_name, NULL); # 422| free (file_name); Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmime.c:431:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘file_name’ where non-null expected shared-mime-info-2.3/xdgmime/src/xdgmime.h:26:34: note: in definition of macro ‘_XDG_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:24:25: note: in expansion of macro ‘_XDG_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:24:37: note: in expansion of macro ‘XDG_PREFIX’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:58:47: note: in expansion of macro ‘XDG_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmime.c:990:1: note: in expansion of macro ‘xdg_mime_get_generic_icon’ <built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null # 429| /* Check the magic file */ # 430| file_name = malloc (strlen (directory) + strlen ("/magic") + 1); # 431|-> strcpy (file_name, directory); strcat (file_name, "/magic"); # 432| invalid = xdg_check_file (file_name, NULL); # 433| free (file_name); Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmimealias.c: scope_hint: In function ‘_xdg_test_alias_list_new’ shared-mime-info-2.3/xdgmime/src/xdgmimealias.c:53:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘list’ # 51| list = malloc (sizeof (XdgAliasList)); # 52| # 53|-> list->aliases = NULL; # 54| list->n_aliases = 0; # 55| Error: GCC_ANALYZER_WARNING (CWE-401): shared-mime-info-2.3/xdgmime/src/xdgmimealias.c: scope_hint: In function ‘_xdg_test_alias_read_from_file’ shared-mime-info-2.3/xdgmime/src/xdgmimealias.c:134:25: warning[-Wanalyzer-malloc-leak]: leak of ‘*list.aliases’ # 132| { # 133| alloc <<= 1; # 134|-> list->aliases = realloc (list->aliases, # 135| alloc * sizeof (XdgAlias)); # 136| } Error: GCC_ANALYZER_WARNING (CWE-401): shared-mime-info-2.3/xdgmime/src/xdgmimealias.c:141:17: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’ # 139| list->n_aliases++; # 140| } # 141|-> list->aliases = realloc (list->aliases, # 142| list->n_aliases * sizeof (XdgAlias)); # 143| Error: GCC_ANALYZER_WARNING (CWE-122): shared-mime-info-2.3/xdgmime/src/xdgmimealias.c:141:19: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow # 139| list->n_aliases++; # 140| } # 141|-> list->aliases = realloc (list->aliases, # 142| list->n_aliases * sizeof (XdgAlias)); # 143| Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmimealias.c:147:5: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected shared-mime-info-2.3/xdgmime/src/xdgmime.h:16: included_from: Included from here. shared-mime-info-2.3/xdgmime/src/xdgmimealias.h:15: included_from: Included from here. shared-mime-info-2.3/xdgmime/src/xdgmimealias.c:16: included_from: Included from here. /usr/include/stdlib.h:970:13: note: argument 1 of ‘qsort’ must be non-null # 145| # 146| if (list->n_aliases > 1) # 147|-> qsort (list->aliases, list->n_aliases, # 148| sizeof (XdgAlias), alias_entry_cmp); # 149| } Error: CLANG_WARNING: shared-mime-info-2.3/xdgmime/src/xdgmimecache.c:238:27: warning[core.NullDereference]: Dereference of null pointer # 236| int *prio) # 237| { # 238|-> xdg_uint32_t priority = GET_UINT32 (cache->buffer, offset); # 239| xdg_uint32_t mimetype_offset = GET_UINT32 (cache->buffer, offset + 4); # 240| xdg_uint32_t n_matchlets = GET_UINT32 (cache->buffer, offset + 8); Error: CLANG_WARNING: shared-mime-info-2.3/xdgmime/src/xdgmimecache.c:379:8: warning[deadcode.DeadStores]: Value stored to 'weight' is never read # 377| int weight = GET_UINT32 (cache->buffer, list_offset + 4 + 12 * mid + 8); # 378| int case_sensitive = weight & 0x100; # 379|-> weight = weight & 0xff; # 380| # 381| if (case_sensitive_check || !case_sensitive) Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmimecache.c: scope_hint: In function ‘ascii_tolower’ shared-mime-info-2.3/xdgmime/src/xdgmimecache.c:583:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘p’ shared-mime-info-2.3/xdgmime/src/xdgmimecache.h:14: included_from: Included from here. shared-mime-info-2.3/xdgmime/src/xdgmimecache.c:36: included_from: Included from here. shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimecache.h:26:55: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimecache.c:822:1: note: in expansion of macro ‘_xdg_mime_cache_get_mime_types_from_file_name’ shared-mime-info-2.3/xdgmime/src/xdgmimecache.c:23: included_from: Included from here. # 581| lower = strdup (str); # 582| p = lower; # 583|-> while (*p != 0) # 584| { # 585| char c = *p; Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmimecache.c: scope_hint: In function ‘_xdg_test_cache_list_mime_parents’ shared-mime-info-2.3/xdgmime/src/xdgmimecache.c:1006:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘result’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null # 1004| # 1005| result = (char **) malloc (p * sizeof (char *)); # 1006|-> memcpy (result, all_parents, p * sizeof (char *)); # 1007| # 1008| return result; Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c: scope_hint: In function ‘_xdg_glob_list_append’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:108:11: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘data’ where non-null expected shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:15: included_from: Included from here. shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:16: included_from: Included from here. shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:32:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:529:1: note: in expansion of macro ‘_xdg_glob_hash_append_glob’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:20: included_from: Included from here. shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:33:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:540:10: note: in expansion of macro ‘_xdg_glob_determine_type’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:21: included_from: Included from here. /usr/include/string.h:156:12: note: argument 2 of ‘strcmp’ must be non-null # 106| while (tmp_element != NULL) # 107| { # 108|-> if (strcmp (tmp_element->data, data) == 0 && # 109| strcmp (tmp_element->mime_type, mime_type) == 0) # 110| return glob_list; Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:109:11: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘mime_type’ where non-null expected shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:32:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:529:1: note: in expansion of macro ‘_xdg_glob_hash_append_glob’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:33:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:540:10: note: in expansion of macro ‘_xdg_glob_determine_type’ /usr/include/string.h:156:12: note: argument 2 of ‘strcmp’ must be non-null # 107| { # 108| if (strcmp (tmp_element->data, data) == 0 && # 109|-> strcmp (tmp_element->mime_type, mime_type) == 0) # 110| return glob_list; # 111| Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:116:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘new_element’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:32:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:529:1: note: in expansion of macro ‘_xdg_glob_hash_append_glob’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:33:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:540:10: note: in expansion of macro ‘_xdg_glob_determine_type’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c: scope_hint: In function ‘_xdg_glob_list_append’ # 114| # 115| new_element = _xdg_glob_list_new (); # 116|-> new_element->data = data; # 117| new_element->mime_type = mime_type; # 118| new_element->weight = weight; Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c: scope_hint: In function ‘_xdg_glob_hash_insert_ucs4’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:180:23: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘glob_hash_node’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:32:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:529:1: note: in expansion of macro ‘_xdg_glob_hash_append_glob’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:33:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:540:10: note: in expansion of macro ‘_xdg_glob_determine_type’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c: scope_hint: In function ‘_xdg_glob_hash_insert_ucs4’ # 178| { # 179| node = _xdg_glob_hash_node_new (); # 180|-> node->character = character; # 181| node->next = glob_hash_node; # 182| glob_hash_node = node; Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:203:31: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘glob_hash_node’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:32:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:529:1: note: in expansion of macro ‘_xdg_glob_hash_append_glob’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:33:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:540:10: note: in expansion of macro ‘_xdg_glob_determine_type’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c: scope_hint: In function ‘_xdg_glob_hash_insert_ucs4’ # 201| { # 202| node = _xdg_glob_hash_node_new (); # 203|-> node->character = character; # 204| node->next = prev_node->next; # 205| prev_node->next = node; Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:222:27: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘glob_hash_node’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:32:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:529:1: note: in expansion of macro ‘_xdg_glob_hash_append_glob’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:33:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:540:10: note: in expansion of macro ‘_xdg_glob_determine_type’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c: scope_hint: In function ‘_xdg_glob_hash_insert_ucs4’ # 220| { # 221| node = _xdg_glob_hash_node_new (); # 222|-> node->character = character; # 223| node->next = prev_node->next; # 224| prev_node->next = node; Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:253:36: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘glob_hash_node’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:32:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:529:1: note: in expansion of macro ‘_xdg_glob_hash_append_glob’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:33:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:540:10: note: in expansion of macro ‘_xdg_glob_determine_type’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c: scope_hint: In function ‘_xdg_glob_hash_insert_ucs4’ # 251| child = _xdg_glob_hash_node_new (); # 252| child->character = 0; # 253|-> child->mime_type = strdup (mime_type); # 254| child->weight = weight; # 255| child->case_sensitive = case_sensitive; Error: CLANG_WARNING: shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:404:3: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 402| assert (file_name != NULL && n_mime_types > 0); # 403| # 404|-> n = 0; # 405| # 406| lower_case = ascii_tolower (file_name); Error: CLANG_WARNING: shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:545:31: warning[unix.Malloc]: Potential memory leak # 543| { # 544| case XDG_GLOB_LITERAL: # 545|-> glob_hash->literal_list = _xdg_glob_list_append (glob_hash->literal_list, strdup (glob), strdup (mime_type), weight, case_sensitive); # 546| break; # 547| case XDG_GLOB_SIMPLE: Error: GCC_ANALYZER_WARNING (CWE-401): shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c: scope_hint: In function ‘_xdg_glob_list_append’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:545:33: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(glob)’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:32:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:529:1: note: in expansion of macro ‘_xdg_glob_hash_append_glob’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:33:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:540:10: note: in expansion of macro ‘_xdg_glob_determine_type’ # 543| { # 544| case XDG_GLOB_LITERAL: # 545|-> glob_hash->literal_list = _xdg_glob_list_append (glob_hash->literal_list, strdup (glob), strdup (mime_type), weight, case_sensitive); # 546| break; # 547| case XDG_GLOB_SIMPLE: Error: GCC_ANALYZER_WARNING (CWE-401): shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:545:33: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(mime_type)’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:32:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:529:1: note: in expansion of macro ‘_xdg_glob_hash_append_glob’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:33:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:540:10: note: in expansion of macro ‘_xdg_glob_determine_type’ # 543| { # 544| case XDG_GLOB_LITERAL: # 545|-> glob_hash->literal_list = _xdg_glob_list_append (glob_hash->literal_list, strdup (glob), strdup (mime_type), weight, case_sensitive); # 546| break; # 547| case XDG_GLOB_SIMPLE: Error: CLANG_WARNING: shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:551:28: warning[unix.Malloc]: Potential memory leak # 549| break; # 550| case XDG_GLOB_FULL: # 551|-> glob_hash->full_list = _xdg_glob_list_append (glob_hash->full_list, strdup (glob), strdup (mime_type), weight, case_sensitive); # 552| break; # 553| } Error: GCC_ANALYZER_WARNING (CWE-401): shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:551:30: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(glob)’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:28:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:594:1: note: in expansion of macro ‘_xdg_mime_glob_read_from_file’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:32:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:671:7: note: in expansion of macro ‘_xdg_glob_hash_append_glob’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:32:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:529:1: note: in expansion of macro ‘_xdg_glob_hash_append_glob’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:33:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:540:10: note: in expansion of macro ‘_xdg_glob_determine_type’ # 549| break; # 550| case XDG_GLOB_FULL: # 551|-> glob_hash->full_list = _xdg_glob_list_append (glob_hash->full_list, strdup (glob), strdup (mime_type), weight, case_sensitive); # 552| break; # 553| } Error: GCC_ANALYZER_WARNING (CWE-401): shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:551:30: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(mime_type)’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:28:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:594:1: note: in expansion of macro ‘_xdg_mime_glob_read_from_file’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:32:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:671:7: note: in expansion of macro ‘_xdg_glob_hash_append_glob’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:32:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:529:1: note: in expansion of macro ‘_xdg_glob_hash_append_glob’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:29:43: note: in expansion of macro ‘_XDG_RESERVED_ENTRY3’ shared-mime-info-2.3/xdgmime/src/xdgmime.h:28:34: note: in expansion of macro ‘_XDG_RESERVED_ENTRY2’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.h:33:47: note: in expansion of macro ‘XDG_RESERVED_ENTRY’ shared-mime-info-2.3/xdgmime/src/xdgmimeglob.c:540:10: note: in expansion of macro ‘_xdg_glob_determine_type’ # 549| break; # 550| case XDG_GLOB_FULL: # 551|-> glob_hash->full_list = _xdg_glob_list_append (glob_hash->full_list, strdup (glob), strdup (mime_type), weight, case_sensitive); # 552| break; # 553| } Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmimeicon.c: scope_hint: In function ‘xdg_test_icon_list_new’ shared-mime-info-2.3/xdgmime/src/xdgmimeicon.c:52:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘list’ # 50| list = malloc (sizeof (XdgIconList)); # 51| # 52|-> list->icons = NULL; # 53| list->n_icons = 0; # 54| Error: GCC_ANALYZER_WARNING (CWE-401): shared-mime-info-2.3/xdgmime/src/xdgmimeicon.c: scope_hint: In function ‘xdg_test_icon_read_from_file’ shared-mime-info-2.3/xdgmime/src/xdgmimeicon.c:133:23: warning[-Wanalyzer-malloc-leak]: leak of ‘*list.icons’ # 131| { # 132| alloc <<= 1; # 133|-> list->icons = realloc (list->icons, # 134| alloc * sizeof (XdgIcon)); # 135| } Error: GCC_ANALYZER_WARNING (CWE-401): shared-mime-info-2.3/xdgmime/src/xdgmimeicon.c:140:15: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’ # 138| list->n_icons++; # 139| } # 140|-> list->icons = realloc (list->icons, # 141| list->n_icons * sizeof (XdgIcon)); # 142| Error: GCC_ANALYZER_WARNING (CWE-122): shared-mime-info-2.3/xdgmime/src/xdgmimeicon.c:140:17: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow # 138| list->n_icons++; # 139| } # 140|-> list->icons = realloc (list->icons, # 141| list->n_icons * sizeof (XdgIcon)); # 142| Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmimeicon.c:146:5: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected shared-mime-info-2.3/xdgmime/src/xdgmime.h:16: included_from: Included from here. shared-mime-info-2.3/xdgmime/src/xdgmimeicon.h:14: included_from: Included from here. shared-mime-info-2.3/xdgmime/src/xdgmimeicon.c:15: included_from: Included from here. /usr/include/stdlib.h:970:13: note: argument 1 of ‘qsort’ must be non-null # 144| # 145| if (list->n_icons > 1) # 146|-> qsort (list->icons, list->n_icons, # 147| sizeof (XdgIcon), icon_entry_cmp); # 148| } Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmimeint.c: scope_hint: In function ‘_xdg_test_convert_to_ucs4’ shared-mime-info-2.3/xdgmime/src/xdgmimeint.c:153:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘out’ # 151| while (*p) # 152| { # 153|-> out[i++] = _xdg_utf8_to_ucs4 (p); # 154| p = _xdg_utf8_next_char (p); # 155| } Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmimeint.c:156:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘out’ # 154| p = _xdg_utf8_next_char (p); # 155| } # 156|-> out[i] = 0; # 157| *len = i; # 158| Error: CPPCHECK_WARNING (CWE-401): shared-mime-info-2.3/xdgmime/src/xdgmimemagic.c:174: error[memleakOnRealloc]: Common realloc mistake: 'retval' nulled but not freed upon failure # 172| { # 173| len = len + 128; # 174|-> retval = realloc (retval, len); # 175| } # 176| } Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmimeparent.c: scope_hint: In function ‘_xdg_test_parent_list_new’ shared-mime-info-2.3/xdgmime/src/xdgmimeparent.c:54:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘list’ # 52| list = malloc (sizeof (XdgParentList)); # 53| # 54|-> list->parents = NULL; # 55| list->n_mimes = 0; # 56| Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmimeparent.c: scope_hint: In function ‘_xdg_test_parent_read_from_file’ shared-mime-info-2.3/xdgmime/src/xdgmimeparent.c:141:39: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ # 139| for (i = 0; i < list->n_mimes; i++) # 140| { # 141|-> if (strcmp (list->parents[i].mime, line) == 0) # 142| { # 143| entry = &(list->parents[i]); Error: GCC_ANALYZER_WARNING (CWE-401): shared-mime-info-2.3/xdgmime/src/xdgmimeparent.c:153:29: warning[-Wanalyzer-malloc-leak]: leak of ‘*list.parents’ # 151| { # 152| alloc <<= 1; # 153|-> list->parents = realloc (list->parents, # 154| alloc * sizeof (XdgMimeParents)); # 155| } Error: GCC_ANALYZER_WARNING (CWE-476): shared-mime-info-2.3/xdgmime/src/xdgmimeparent.c:173:44: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*entry.parents + ((long unsigned int)*entry.n_parents * 8 + 18446744073709551608)’ # 171| (entry->n_parents + 2) * sizeof (char *)); # 172| } # 173|-> entry->parents[entry->n_parents - 1] = strdup (sep); # 174| entry->parents[entry->n_parents] = NULL; # 175| } Error: GCC_ANALYZER_WARNING (CWE-401): shared-mime-info-2.3/xdgmime/src/xdgmimeparent.c:177:17: warning[-Wanalyzer-malloc-leak]: leak of ‘*list.parents’ # 175| } # 176| # 177|-> list->parents = realloc (list->parents, # 178| list->n_mimes * sizeof (XdgMimeParents)); # 179| Error: GCC_ANALYZER_WARNING (CWE-401): shared-mime-info-2.3/xdgmime/src/xdgmimeparent.c:177:17: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’ # 175| } # 176| # 177|-> list->parents = realloc (list->parents, # 178| list->n_mimes * sizeof (XdgMimeParents)); # 179| Error: GCC_ANALYZER_WARNING (CWE-122): shared-mime-info-2.3/xdgmime/src/xdgmimeparent.c:177:19: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow # 175| } # 176| # 177|-> list->parents = realloc (list->parents, # 178| list->n_mimes * sizeof (XdgMimeParents)); # 179| Error: GCC_ANALYZER_WARNING (CWE-688): shared-mime-info-2.3/xdgmime/src/xdgmimeparent.c:183:5: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected shared-mime-info-2.3/xdgmime/src/xdgmime.h:16: included_from: Included from here. shared-mime-info-2.3/xdgmime/src/xdgmimeparent.h:15: included_from: Included from here. shared-mime-info-2.3/xdgmime/src/xdgmimeparent.c:16: included_from: Included from here. /usr/include/stdlib.h:970:13: note: argument 1 of ‘qsort’ must be non-null # 181| # 182| if (list->n_mimes > 1) # 183|-> qsort (list->parents, list->n_mimes, # 184| sizeof (XdgMimeParents), &parent_entry_cmp); # 185| }