Fixed findings

List of Findings

Error: COMPILER_WARNING (CWE-195): [#def1]
shared-mime-info-2.4/src/update-mime-database.cpp: scope_hint: In function ‘Type* get_type(const char*, GError**)’
shared-mime-info-2.4/src/update-mime-database.cpp:275:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
#  275 |         for (i = 0; i < G_N_ELEMENTS(media_types); i++)
#  273|   		(xmlChar *)"Created automatically by update-mime-database. DO NOT EDIT!"));
#  274|   
#  275|-> 	for (i = 0; i < G_N_ELEMENTS(media_types); i++)
#  276|   	{
#  277|   		if (strcmp(media_types[i], type->media) == 0)

Error: COMPILER_WARNING (CWE-195): [#def2]
shared-mime-info-2.4/src/update-mime-database.cpp: scope_hint: In function ‘void delete_old_types(const gchar*)’
shared-mime-info-2.4/src/update-mime-database.cpp:1962:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
# 1962 |         for (i = 0; i < G_N_ELEMENTS(media_types); i++)
# 1960|   	int i;
# 1961|   
# 1962|-> 	for (i = 0; i < G_N_ELEMENTS(media_types); i++)
# 1963|   	{
# 1964|   		const fs::path media_dir = g_strconcat(mime_dir, "/", media_types[i], nullptr);

Error: COMPILER_WARNING (CWE-195): [#def3]
shared-mime-info-2.4/src/update-mime-database.cpp: scope_hint: In function ‘void write_namespaces(FILE*)’
shared-mime-info-2.4/src/update-mime-database.cpp:2021:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
# 2021 |         for (i = 0; i < lines->len; i++)
#      |                     ~~^~~~~~~~~~~~
# 2019|   	g_ptr_array_sort(lines, strcmp2);
# 2020|   
# 2021|-> 	for (i = 0; i < lines->len; i++)
# 2022|   	{
# 2023|   		char *line = (char *) lines->pdata[i];

Error: COMPILER_WARNING (CWE-195): [#def4]
shared-mime-info-2.4/src/update-mime-database.cpp: scope_hint: In function ‘void write_aliases(FILE*)’
shared-mime-info-2.4/src/update-mime-database.cpp:2080:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
# 2080 |         for (i = 0; i < lines->len; i++)
#      |                     ~~^~~~~~~~~~~~
# 2078|   	g_ptr_array_sort(lines, strcmp2);
# 2079|   
# 2080|-> 	for (i = 0; i < lines->len; i++)
# 2081|   	{
# 2082|   		char *line = (char *) lines->pdata[i];

Error: COMPILER_WARNING (CWE-195): [#def5]
shared-mime-info-2.4/src/update-mime-database.cpp: scope_hint: In function ‘void write_types(FILE*)’
shared-mime-info-2.4/src/update-mime-database.cpp:2111:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
# 2111 |         for (i = 0; i < lines->len; i++)
#      |                     ~~^~~~~~~~~~~~
# 2109|   	g_ptr_array_sort(lines, strcmp2);
# 2110|   
# 2111|-> 	for (i = 0; i < lines->len; i++)
# 2112|   	{
# 2113|   		char *line = (char *) lines->pdata[i];

Error: COMPILER_WARNING (CWE-195): [#def6]
shared-mime-info-2.4/src/update-mime-database.cpp: scope_hint: In function ‘gboolean write_types_cache(FILE*, GHashTable*, GHashTable*, guint*)’
shared-mime-info-2.4/src/update-mime-database.cpp:3218:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
# 3218 |         for (i = 0; i < lines->len; i++)
#      |                     ~~^~~~~~~~~~~~
# 3216|       		return FALSE;
# 3217|   
# 3218|-> 	for (i = 0; i < lines->len; i++)
# 3219|   	{
# 3220|   		mimetype = (char *) lines->pdata[i];

Error: COMPILER_WARNING (CWE-195): [#def7]
shared-mime-info-2.4/src/update-mime-database.cpp: scope_hint: In function ‘int main(int, char**)’
shared-mime-info-2.4/src/update-mime-database.cpp:3794:31: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
# 3794 |                 for (i = 0; i < magic_array->len; i++)
#      |                             ~~^~~~~~~~~~~~~~~~~~
# 3792|   		if (magic_array->len)
# 3793|   			g_ptr_array_sort(magic_array, cmp_magic);
# 3794|-> 		for (i = 0; i < magic_array->len; i++)
# 3795|   		{
# 3796|   			Magic *magic = (Magic *) magic_array->pdata[i];

Error: COMPILER_WARNING (CWE-195): [#def8]
shared-mime-info-2.4/src/update-mime-database.cpp:3915:31: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
# 3915 |                 for (i = 0; i < tree_magic_array->len; i++)
#      |                             ~~^~~~~~~~~~~~~~~~~~~~~~~
# 3913|   		if (tree_magic_array->len)
# 3914|   			g_ptr_array_sort(tree_magic_array, cmp_tree_magic);
# 3915|-> 		for (i = 0; i < tree_magic_array->len; i++)
# 3916|   		{
# 3917|   			TreeMagic *magic = (TreeMagic *) tree_magic_array->pdata[i];

Error: CPPCHECK_WARNING (CWE-476): [#def9]
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:108: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: data
#  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): [#def10]
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:108:11: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘data’ where non-null expected
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:529:1: enter_function: entry to ‘_xdg_test_hash_append_glob’
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:537:3: branch_false: following ‘false’ branch (when ‘glob_hash’ is non-NULL)...
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:538:3: branch_false: ...to here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:538:3: branch_false: following ‘false’ branch (when ‘glob’ is non-NULL)...
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:540:10: branch_false: ...to here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:545:81: acquire_memory: this call could return NULL
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:545:33: call_function: calling ‘_xdg_glob_list_append’ from ‘_xdg_test_hash_append_glob’
#  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: CPPCHECK_WARNING (CWE-476): [#def11]
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:109: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: mime_type
#  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-688): [#def12]
shared-mime-info-2.4/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.4/xdgmime/src/xdgmimeglob.c:529:1: enter_function: entry to ‘_xdg_test_hash_append_glob’
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:537:3: branch_false: following ‘false’ branch (when ‘glob_hash’ is non-NULL)...
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:538:3: branch_false: ...to here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:538:3: branch_false: following ‘false’ branch (when ‘glob’ is non-NULL)...
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:540:10: branch_false: ...to here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:545:96: acquire_memory: this call could return NULL
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:545:33: call_function: calling ‘_xdg_glob_list_append’ from ‘_xdg_test_hash_append_glob’
#  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): [#def13]
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:116:3: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘new_element’
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:529:1: enter_function: entry to ‘_xdg_test_hash_append_glob’
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:537:3: branch_false: following ‘false’ branch (when ‘glob_hash’ is non-NULL)...
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:538:3: branch_false: ...to here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:538:3: branch_false: following ‘false’ branch (when ‘glob’ is non-NULL)...
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:540:10: branch_false: ...to here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:545:33: call_function: calling ‘_xdg_glob_list_append’ from ‘_xdg_test_hash_append_glob’
#  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-401): [#def14]
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:545:33: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(glob)’
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:529:1: enter_function: entry to ‘_xdg_test_hash_append_glob’
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:537:3: branch_false: following ‘false’ branch (when ‘glob_hash’ is non-NULL)...
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:538:3: branch_false: ...to here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:538:3: branch_false: following ‘false’ branch (when ‘glob’ is non-NULL)...
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:540:10: branch_false: ...to here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:545:81: acquire_memory: allocated here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:545:33: call_function: calling ‘_xdg_glob_list_append’ from ‘_xdg_test_hash_append_glob’
#  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): [#def15]
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:545:33: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(mime_type)’
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:529:1: enter_function: entry to ‘_xdg_test_hash_append_glob’
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:537:3: branch_false: following ‘false’ branch (when ‘glob_hash’ is non-NULL)...
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:538:3: branch_false: ...to here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:538:3: branch_false: following ‘false’ branch (when ‘glob’ is non-NULL)...
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:540:10: branch_false: ...to here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:545:96: acquire_memory: allocated here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:545:33: call_function: calling ‘_xdg_glob_list_append’ from ‘_xdg_test_hash_append_glob’
#  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): [#def16]
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:551:30: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(glob)’
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:529:1: enter_function: entry to ‘_xdg_test_hash_append_glob’
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:537:3: branch_false: following ‘false’ branch (when ‘glob_hash’ is non-NULL)...
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:538:3: branch_false: ...to here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:538:3: branch_false: following ‘false’ branch (when ‘glob’ is non-NULL)...
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:540:10: branch_false: ...to here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:551:75: acquire_memory: allocated here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:551:30: call_function: calling ‘_xdg_glob_list_append’ from ‘_xdg_test_hash_append_glob’
#  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): [#def17]
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:551:30: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(mime_type)’
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:529:1: enter_function: entry to ‘_xdg_test_hash_append_glob’
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:537:3: branch_false: following ‘false’ branch (when ‘glob_hash’ is non-NULL)...
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:538:3: branch_false: ...to here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:538:3: branch_false: following ‘false’ branch (when ‘glob’ is non-NULL)...
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:540:10: branch_false: ...to here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:551:90: acquire_memory: allocated here
shared-mime-info-2.4/xdgmime/src/xdgmimeglob.c:551:30: call_function: calling ‘_xdg_glob_list_append’ from ‘_xdg_test_hash_append_glob’
#  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|       }

Scan Properties

analyzer-version-clippy1.97.1
analyzer-version-cppcheck2.21.1
analyzer-version-gcc16.1.1
analyzer-version-gcc-analyzer16.1.1
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.97.1
diffbase-analyzer-version-cppcheck2.21.1
diffbase-analyzer-version-gcc16.1.1
diffbase-analyzer-version-gcc-analyzer16.1.1
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-63.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20260524.213755.g3c6d0be.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-nameshared-mime-info-2.5.1-2.fc45
diffbase-store-results-to/tmp/tmp1k1j47wp/shared-mime-info-2.5.1-2.fc45.tar.xz
diffbase-time-created2026-08-03 20:54:15
diffbase-time-finished2026-08-03 20:55:32
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,clippy,unicontrol,shellcheck,cppcheck' '-o' '/tmp/tmp1k1j47wp/shared-mime-info-2.5.1-2.fc45.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmp1k1j47wp/shared-mime-info-2.5.1-2.fc45.src.rpm'
diffbase-tool-versioncsmock-3.8.7.20260803.142340.gb75b18e-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-63.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20260524.213755.g3c6d0be.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-nameshared-mime-info-2.4-3.fc44
store-results-to/tmp/tmpnngnt93i/shared-mime-info-2.4-3.fc44.tar.xz
time-created2026-08-03 20:51:52
time-finished2026-08-03 20:53:59
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,clippy,unicontrol,shellcheck,cppcheck' '-o' '/tmp/tmpnngnt93i/shared-mime-info-2.4-3.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpnngnt93i/shared-mime-info-2.4-3.fc44.src.rpm'
tool-versioncsmock-3.8.7.20260803.142340.gb75b18e-1.el9