Task #131211 - added.err

back to task #131211
download
Error: GCC_ANALYZER_WARNING (CWE-476):
kbd-2.10.0/src/libkbdfile/kbdfile.c:488:13: warning[-Wanalyzer-null-dereference]: dereference of NULL 'fnam'
kbd-2.10.0/src/libkbdfile/kbdfile.c:468:1: enter_function: entry to 'kbdfile_find'
kbd-2.10.0/src/libkbdfile/kbdfile.c:472:12: branch_false: following 'false' branch...
kbd-2.10.0/src/libkbdfile/kbdfile.c:477:9: branch_false: ...to here
kbd-2.10.0/src/libkbdfile/kbdfile.c:481:9: call_function: calling 'kbdfile_set_pathname' from 'kbdfile_find'
kbd-2.10.0/src/libkbdfile/kbdfile.c:481:9: return_function: returning to 'kbdfile_find' from 'kbdfile_set_pathname'
kbd-2.10.0/src/libkbdfile/kbdfile.c:483:14: call_function: calling 'maybe_pipe_open' from 'kbdfile_find'
kbd-2.10.0/src/libkbdfile/kbdfile.c:483:14: return_function: returning to 'kbdfile_find' from 'maybe_pipe_open'
kbd-2.10.0/src/libkbdfile/kbdfile.c:483:12: branch_false: following 'false' branch...
kbd-2.10.0/src/libkbdfile/kbdfile.c:488:13: branch_false: ...to here
kbd-2.10.0/src/libkbdfile/kbdfile.c:488:13: danger: dereference of NULL 'fnam'
#  486|   	/* Test for full pathname - opening it failed, so need suffix */
#  487|   	/* (This is just nonsense, for backwards compatibility.) */
#  488|-> 	if (*fnam == '/' &&
#  489|   	    !findfile_by_fullname(fnam, suffixes, fp))
#  490|   		return 0;

Error: GCC_ANALYZER_WARNING (CWE-401):
kbd-2.10.0/src/libkfont/psffontop.c:213:32: warning[-Wanalyzer-malloc-leak]: leak of ‘inputbuf’
kbd-2.10.0/src/libkfont/psffontop.c:195:1: enter_function: entry to ‘kfont_read_psffont’
kbd-2.10.0/src/libkfont/psffontop.c:211:12: branch_true: following ‘true’ branch (when ‘fontf’ is non-NULL)...
kbd-2.10.0/src/libkfont/psffontop.c:212:28: branch_true: ...to here
kbd-2.10.0/src/libkfont/psffontop.c:212:28: call_function: calling ‘read_fontfile’ from ‘kfont_read_psffont’
kbd-2.10.0/src/libkfont/psffontop.c:212:28: return_function: returning to ‘kfont_read_psffont’ from ‘read_fontfile’
kbd-2.10.0/src/libkfont/psffontop.c:212:20: branch_false: following ‘false’ branch...
kbd-2.10.0/src/libkfont/psffontop.c:215:20: branch_false: ...to here
kbd-2.10.0/src/libkfont/psffontop.c:215:20: branch_false: following ‘false’ branch (when ‘allbufp’ is NULL)...
kbd-2.10.0/src/libkfont/psffontop.c:217:20: branch_false: ...to here
kbd-2.10.0/src/libkfont/psffontop.c:213:32: danger: ‘inputbuf’ leaks here; was allocated at [(10)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/9)
#  211|   	if (fontf) {
#  212|   		if ((ret = read_fontfile(ctx, fontf, &inputbuf, &inputlth)) < 0)
#  213|-> 			return ret;
#  214|   
#  215|   		if (allbufp)

Error: COMPILER_WARNING (CWE-563):
kbd-2.10.0/src/openvt.c: scope_hint: In function ‘proc_pid_stat’
kbd-2.10.0/src/openvt.c:65:15: warning[-Wunused-variable]: unused variable ‘lp’
#   65 |         char *lp, *rp;
#      |               ^~
#   63|   	char filename[NAME_MAX + 12];
#   64|   	char line[BUFSIZ];
#   65|-> 	char *lp, *rp;
#   66|   	FILE *fp;
#   67|   	struct stat st;

Error: GCC_ANALYZER_WARNING (CWE-401):
kbd-2.10.0/src/openvt.c:150:20: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir("/proc")’
kbd-2.10.0/src/openvt.c:141:20: acquire_memory: allocated here
kbd-2.10.0/src/openvt.c:141:12: branch_false: following ‘false’ branch...
kbd-2.10.0/src/openvt.c:146:9: branch_false: ...to here
kbd-2.10.0/src/openvt.c:147:12: branch_true: following ‘true’ branch...
kbd-2.10.0/src/openvt.c:148:29: branch_true: ...to here
kbd-2.10.0/src/openvt.c:150:20: danger: ‘opendir("/proc")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  148|   		int errsv = errno;
#  149|   		snprintf(filename, sizeof(filename), VTNAME2, curvt);
#  150|-> 		if (stat(filename, &buf)) {
#  151|   			/* give error message for first attempt */
#  152|   			snprintf(filename, sizeof(filename), VTNAME, curvt);

Error: GCC_ANALYZER_WARNING (CWE-401):
kbd-2.10.0/src/openvt.c:159:12: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir("/proc")’
kbd-2.10.0/src/openvt.c:141:20: acquire_memory: allocated here
kbd-2.10.0/src/openvt.c:141:12: branch_false: following ‘false’ branch...
kbd-2.10.0/src/openvt.c:146:9: branch_false: ...to here
kbd-2.10.0/src/openvt.c:159:12: danger: ‘opendir("/proc")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  157|   	console_uid = buf.st_uid;
#  158|   
#  159|-> 	if (console_uid == 0)
#  160|   		kbd_error(EXIT_FAILURE, 0, _("Refusing to pre-authenticate root on current tty."));
#  161|   

Error: GCC_ANALYZER_WARNING (CWE-401):
kbd-2.10.0/src/openvt.c:163:12: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir("/proc")’
kbd-2.10.0/src/openvt.c:141:20: acquire_memory: allocated here
kbd-2.10.0/src/openvt.c:141:12: branch_false: following ‘false’ branch...
kbd-2.10.0/src/openvt.c:146:9: branch_false: ...to here
kbd-2.10.0/src/openvt.c:159:12: branch_false: following ‘false’ branch (when ‘console_uid != 0’)...
kbd-2.10.0/src/openvt.c:163:23: branch_false: ...to here
kbd-2.10.0/src/openvt.c:163:12: danger: ‘opendir("/proc")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  161|   
#  162|   	/* get the owner of current tty */
#  163|-> 	if (!(pwnam = getpwuid(console_uid)))
#  164|   		kbd_error(EXIT_FAILURE, errno, "getpwuid");
#  165|   

Error: GCC_ANALYZER_WARNING (CWE-121):
kbd-2.10.0/src/xkbsupport.c:1151:17: warning[-Wanalyzer-out-of-bounds]: stack-based buffer overflow
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:32:1: enter_function: entry to ‘test_sequence_dedup_keeps_best_candidate’
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:56:20: call_function: calling ‘xkeymap_select_compose_candidates’ from ‘test_sequence_dedup_keeps_best_candidate’
# 1149|   			continue;
# 1150|   
# 1151|-> 		candidates[out++] = candidates[i];
# 1152|   	}
# 1153|   

Error: GCC_ANALYZER_WARNING (CWE-401):
kbd-2.10.0/src/xkbsupport.c:1267:24: warning[-Wanalyzer-malloc-leak]: leak of ‘rule’
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:68:1: enter_function: entry to ‘test_kernel_rule_dedup_happens_after_selection’
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:94:9: call_function: calling ‘init_test_keymap’ from ‘test_kernel_rule_dedup_happens_after_selection’
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:94:9: return_function: returning to ‘test_kernel_rule_dedup_happens_after_selection’ from ‘init_test_keymap’
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:97:13: call_function: calling ‘xkeymap_append_compose_candidates’ from ‘test_kernel_rule_dedup_happens_after_selection’
# 1265|   		struct lk_kbdiacr diacr;
# 1266|   
# 1267|-> 		rule = malloc(sizeof(*rule));
# 1268|   		if (!rule) {
# 1269|   			ret = -1;

Error: GCC_ANALYZER_WARNING (CWE-401):
kbd-2.10.0/src/xkbsupport.c:1281:20: warning[-Wanalyzer-malloc-leak]: leak of ‘rule’
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:68:1: enter_function: entry to ‘test_kernel_rule_dedup_happens_after_selection’
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:94:9: call_function: calling ‘init_test_keymap’ from ‘test_kernel_rule_dedup_happens_after_selection’
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:94:9: return_function: returning to ‘test_kernel_rule_dedup_happens_after_selection’ from ‘init_test_keymap’
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:97:13: call_function: calling ‘xkeymap_append_compose_candidates’ from ‘test_kernel_rule_dedup_happens_after_selection’
# 1279|   		}
# 1280|   
# 1281|-> 		if (*val != rule) {
# 1282|   			free(rule);
# 1283|   			continue;

Error: GCC_ANALYZER_WARNING (CWE-401):
kbd-2.10.0/tests/libkeymap/libkeymap-test.h:37:1: warning[-Wanalyzer-malloc-leak]: leak of ‘rule’
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:113:1: enter_function: entry to ‘test_compose_append_uses_kbd_conversion_rules’
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:129:9: call_function: calling ‘init_test_keymap’ from ‘test_compose_append_uses_kbd_conversion_rules’
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:129:9: return_function: returning to ‘test_compose_append_uses_kbd_conversion_rules’ from ‘init_test_keymap’
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:132:13: call_function: calling ‘xkeymap_append_compose_candidates’ from ‘test_compose_append_uses_kbd_conversion_rules’
#   35|   
#   36|   	kbdfile_set_pathname(keymap->kbdfile, pathname);
#   37|-> }
#   38|   
#   39|   static inline int

Error: GCC_ANALYZER_WARNING (CWE-775):
kbd-2.10.0/tests/libkeymap/libkeymap-test52.c:19:12: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "w")’
kbd-2.10.0/tests/libkeymap/libkeymap-test52.c:14:20: acquire_resource: opened here
kbd-2.10.0/tests/libkeymap/libkeymap-test52.c:16:12: branch_false: following ‘false’ branch...
kbd-2.10.0/tests/libkeymap/libkeymap-test52.c:19:13: branch_false: ...to here
kbd-2.10.0/tests/libkeymap/libkeymap-test52.c:19:12: danger: ‘fopen(path, "w")’ leaks here; was opened at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   17|   		kbd_error(EXIT_FAILURE, errno, "Unable to open %s", path);
#   18|   
#   19|-> 	if (fputs(content, fp) == EOF)
#   20|   		kbd_error(EXIT_FAILURE, errno, "Unable to write %s", path);
#   21|   

Error: GCC_ANALYZER_WARNING (CWE-401):
kbd-2.10.0/tests/libkeymap/libkeymap-test52.c:19:12: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "w")’
kbd-2.10.0/tests/libkeymap/libkeymap-test52.c:14:20: acquire_memory: allocated here
kbd-2.10.0/tests/libkeymap/libkeymap-test52.c:16:12: branch_false: following ‘false’ branch...
kbd-2.10.0/tests/libkeymap/libkeymap-test52.c:19:13: branch_false: ...to here
kbd-2.10.0/tests/libkeymap/libkeymap-test52.c:19:12: danger: ‘fopen(path, "w")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#   17|   		kbd_error(EXIT_FAILURE, errno, "Unable to open %s", path);
#   18|   
#   19|-> 	if (fputs(content, fp) == EOF)
#   20|   		kbd_error(EXIT_FAILURE, errno, "Unable to write %s", path);
#   21|   

Error: COMPILER_WARNING:
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:1:9: warning: ‘_GNU_SOURCE’ redefined
#    1 | #define _GNU_SOURCE
#      |         ^~~~~~~~~~~
<command-line>: note: this is the location of the previous definition
#    1|-> #define _GNU_SOURCE
#    2|   #include <stdlib.h>
#    3|   

Error: COMPILER_WARNING:
kbd-2.10.0/tests/libkeymap/libkeymap-test55.c:1:9: warning[warning]: ‘_GNU_SOURCE’ redefined
#    1|-> #define _GNU_SOURCE
#    2|   #include <stdlib.h>
#    3|   

Error: GCC_ANALYZER_WARNING (CWE-401):
kbd-2.10.0/tests/libkfont/libkfont-test15.c:120:12: warning[-Wanalyzer-malloc-leak]: leak of ‘tmpfile()’
kbd-2.10.0/tests/libkfont/libkfont-test15.c:69:12: branch_false: following ‘false’ branch...
kbd-2.10.0/tests/libkfont/libkfont-test15.c:72:9: branch_false: ...to here
kbd-2.10.0/tests/libkfont/libkfont-test15.c:116:14: acquire_memory: allocated here
kbd-2.10.0/tests/libkfont/libkfont-test15.c:117:12: branch_false: following ‘false’ branch...
kbd-2.10.0/tests/libkfont/libkfont-test15.c:120:13: branch_false: ...to here
kbd-2.10.0/tests/libkfont/libkfont-test15.c:120:12: danger: ‘tmpfile()’ leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  118|   		kbd_error(EXIT_FAILURE, errno, "tmpfile failed");
#  119|   
#  120|-> 	if (fwrite(psf, sizeof(psf), 1, fp) != 1)
#  121|   		kbd_error(EXIT_FAILURE, errno, "unable to write psf2 test image");
#  122|   

Error: GCC_ANALYZER_WARNING (CWE-775):
kbd-2.10.0/tests/libkfont/libkfont-test19.c:82:12: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "rb")’
kbd-2.10.0/tests/libkfont/libkfont-test19.c:77:20: acquire_resource: opened here
kbd-2.10.0/tests/libkfont/libkfont-test19.c:79:12: branch_false: following ‘false’ branch...
kbd-2.10.0/tests/libkfont/libkfont-test19.c:82:13: branch_false: ...to here
kbd-2.10.0/tests/libkfont/libkfont-test19.c:82:12: danger: ‘fopen(path, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   80|   		kbd_error(EXIT_FAILURE, errno, "fopen failed for %s", path);
#   81|   
#   82|-> 	if (fread(buf, size, 1, fp) != 1)
#   83|   		kbd_error(EXIT_FAILURE, errno, "fread failed for %s", path);
#   84|   

Error: GCC_ANALYZER_WARNING (CWE-401):
kbd-2.10.0/tests/libkfont/libkfont-test19.c:82:12: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "rb")’
kbd-2.10.0/tests/libkfont/libkfont-test19.c:77:20: acquire_memory: allocated here
kbd-2.10.0/tests/libkfont/libkfont-test19.c:79:12: branch_false: following ‘false’ branch...
kbd-2.10.0/tests/libkfont/libkfont-test19.c:82:13: branch_false: ...to here
kbd-2.10.0/tests/libkfont/libkfont-test19.c:82:12: danger: ‘fopen(path, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#   80|   		kbd_error(EXIT_FAILURE, errno, "fopen failed for %s", path);
#   81|   
#   82|-> 	if (fread(buf, size, 1, fp) != 1)
#   83|   		kbd_error(EXIT_FAILURE, errno, "fread failed for %s", path);
#   84|   

Error: COMPILER_WARNING:
kbd-2.10.0/tests/libkfont/libkfont-test24.c: scope_hint: In function ‘capture_logger’
kbd-2.10.0/tests/libkfont/libkfont-test24.c:25:9: warning[-Wsuggest-attribute=format]: function ‘capture_logger’ might be a candidate for ‘gnu_printf’ format attribute
#   25 |         vsnprintf(last_message, sizeof(last_message), format, args);
#      |         ^~~~~~~~~
#   23|   	log_calls++;
#   24|   	last_priority = priority;
#   25|-> 	vsnprintf(last_message, sizeof(last_message), format, args);
#   26|   }
#   27|