Task #132809 - fixed.err

back to task #132809
download
Error: COMPILER_WARNING (CWE-195):
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):
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):
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):
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):
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):
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):
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):
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):
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):
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):
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):
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):
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):
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):
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):
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):
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|       }