Error: GCC_ANALYZER_WARNING (CWE-775): [#def1] kbd-2.6.4-build/kbd-2.6.4/src/libcommon/getfd.c: scope_hint: In function ‘open_a_console’ kbd-2.6.4-build/kbd-2.6.4/src/libcommon/getfd.c:54:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘fd’ # 52| if (fd < 0) # 53| fd = open(fnam, O_RDONLY); # 54|-> if (fd < 0) # 55| return -1; # 56| return fd; Error: GCC_ANALYZER_WARNING (CWE-401): [#def2] kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/analyze.c: scope_hint: In function ‘yy_create_buffer’ kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/analyze.c:2293:12: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(64)’ kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/analyze.c: scope_hint: In function ‘yy_create_buffer’ # 2291| * we need to put in 2 end-of-buffer characters. # 2292| */ # 2293|-> b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); # 2294| if ( ! b->yy_ch_buf ) # 2295| YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); Error: GCC_ANALYZER_WARNING (CWE-401): [#def3] kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/analyze.c: scope_hint: In function ‘yy_create_buffer’ kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/analyze.c:2293:12: warning[-Wanalyzer-malloc-leak]: leak of ‘yyalloc(64, yyscanner)’ # 2291| * we need to put in 2 end-of-buffer characters. # 2292| */ # 2293|-> b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); # 2294| if ( ! b->yy_ch_buf ) # 2295| YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); Error: GCC_ANALYZER_WARNING (CWE-476): [#def4] kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/analyze.c: scope_hint: In function ‘yy_init_buffer’ kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/analyze.c:2335:19: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘b’ # 2333| # 2334| yy_flush_buffer( b , yyscanner); # 2335|-> # 2336| b->yy_input_file = file; # 2337| b->yy_fill_buffer = 1; Error: GCC_ANALYZER_WARNING (CWE-401): [#def5] kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/analyze.c: scope_hint: In function ‘yy_scan_buffer’ kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/analyze.c:2553:25: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(n)’ kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/analyze.c: scope_hint: In function ‘yy_scan_buffer’ # 2551| for ( i = 0; i < _yybytes_len; ++i ) # 2552| buf[i] = yybytes[i]; # 2553|-> # 2554| buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; # 2555| Error: GCC_ANALYZER_WARNING (CWE-401): [#def6] kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/analyze.c: scope_hint: In function ‘yy_scan_buffer’ kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/analyze.c:2553:25: warning[-Wanalyzer-malloc-leak]: leak of ‘yyalloc(n, yyscanner)’ # 2551| for ( i = 0; i < _yybytes_len; ++i ) # 2552| buf[i] = yybytes[i]; # 2553|-> # 2554| buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; # 2555| Error: GCC_ANALYZER_WARNING (CWE-457): [#def7] kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/parser.c: scope_hint: In function ‘yyparse’ kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/parser.c:719:7: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘yyss’ kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/parser.c:704:9: note: in expansion of macro ‘YYCOPY’ kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/parser.c:1565:9: note: in expansion of macro ‘YYSTACK_RELOCATE’ kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/parser.c:704:9: note: in expansion of macro ‘YYCOPY’ kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/parser.c:1565:9: note: in expansion of macro ‘YYSTACK_RELOCATE’ kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/parser.c:704:9: note: in expansion of macro ‘YYCOPY’ kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/parser.c:1565:9: note: in expansion of macro ‘YYSTACK_RELOCATE’ # 717| # if defined __GNUC__ && 1 < __GNUC__ # 718| # define YYCOPY(Dst, Src, Count) \ # 719|-> __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # 720| # else # 721| # define YYCOPY(Dst, Src, Count) \ Error: GCC_ANALYZER_WARNING (CWE-457): [#def8] kbd-2.6.4-build/kbd-2.6.4/src/libkeymap/parser.c:1692:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’ # 1690| unconditionally makes the parser a bit smaller, and it avoids a # 1691| GCC warning that YYVAL may be used uninitialized. */ # 1692|-> yyval = yyvsp[1-yylen]; # 1693| # 1694| Error: GCC_ANALYZER_WARNING (CWE-401): [#def9] kbd-2.6.4-build/kbd-2.6.4/src/libkfont/loadunimap.c: scope_hint: In function ‘add_unipair’ kbd-2.6.4-build/kbd-2.6.4/src/libkfont/loadunimap.c:107:23: warning[-Wanalyzer-malloc-leak]: leak of ‘list’ kbd-2.6.4-build/kbd-2.6.4/src/libkfont/loadunimap.c:25: included_from: Included from here. kbd-2.6.4-build/kbd-2.6.4/src/libkfont/loadunimap.c:267:9: note: in expansion of macro ‘KFONT_INFO’ kbd-2.6.4-build/kbd-2.6.4/src/libcommon/libcommon.h:17: included_from: Included from here. kbd-2.6.4-build/kbd-2.6.4/src/libkfont/loadunimap.c:24: included_from: Included from here. kbd-2.6.4-build/kbd-2.6.4/src/libkfont/kfontP.h:39:90: note: in expansion of macro ‘_’ kbd-2.6.4-build/kbd-2.6.4/src/libkfont/loadunimap.c:273:25: note: in expansion of macro ‘KFONT_WARN’ # 105| if (*listct == *listsz) { # 106| *listsz += 4096; # 107|-> *list = realloc(*list, *listsz); # 108| if (!*list) { # 109| KFONT_ERR(ctx, "realloc: %m"); Error: GCC_ANALYZER_WARNING (CWE-401): [#def10] kbd-2.6.4-build/kbd-2.6.4/src/libkfont/psffontop.c: scope_hint: In function ‘kfont_read_psffont’ kbd-2.6.4-build/kbd-2.6.4/src/libkfont/psffontop.c:214:32: warning[-Wanalyzer-malloc-leak]: leak of ‘inputbuf’ # 212| if (fontf) { # 213| if ((ret = read_fontfile(ctx, fontf, &inputbuf, &inputlth)) < 0) # 214|-> return ret; # 215| # 216| if (allbufp) Error: COMPILER_WARNING (CWE-457): [#def11] kbd-2.6.4-build/kbd-2.6.4/src/libkfont/psffontop.c:232:12: warning[-Wmaybe-uninitialized]: 'inbuflth' may be used uninitialized # 232 | if (inputlth >= sizeof(struct psf1_header) && PSF1_MAGIC_OK(inputbuf)) { # | ^ kbd-2.6.4-build/kbd-2.6.4/src/psfxtable.c: scope_hint: In function 'main' kbd-2.6.4-build/kbd-2.6.4/src/psfxtable.c:45:22: note: 'inbuflth' was declared here # 45 | unsigned int inbuflth, fontbuflth; # | ^ # 230| int utf8; # 231| # 232|-> if (inputlth >= sizeof(struct psf1_header) && PSF1_MAGIC_OK(inputbuf)) { # 233| struct psf1_header *psfhdr; # 234| Error: COMPILER_WARNING (CWE-457): [#def12] kbd-2.6.4-build/kbd-2.6.4/src/libkfont/psffontop.c:232:55: warning[-Wmaybe-uninitialized]: 'inbuf' may be used uninitialized # 232 | if (inputlth >= sizeof(struct psf1_header) && PSF1_MAGIC_OK(inputbuf)) { # | ^ kbd-2.6.4-build/kbd-2.6.4/src/psfxtable.c: scope_hint: In function 'main' kbd-2.6.4-build/kbd-2.6.4/src/psfxtable.c:44:24: note: 'inbuf' was declared here # 44 | unsigned char *inbuf, *fontbuf; # | ^ # 230| int utf8; # 231| # 232|-> if (inputlth >= sizeof(struct psf1_header) && PSF1_MAGIC_OK(inputbuf)) { # 233| struct psf1_header *psfhdr; # 234| Error: CPPCHECK_WARNING (CWE-590): [#def13] kbd-2.6.4-build/kbd-2.6.4/src/libkfont/psffontop.c:239: error[autovarInvalidDeallocation]: Deallocation of an auto-variable ([) results in undefined behaviour. # 237| if (psfhdr->mode > PSF1_MAXMODE) { # 238| KFONT_ERR(ctx, _("Unsupported psf file mode (%d)"), psfhdr->mode); # 239|-> free(psfhdr); # 240| return -EX_DATAERR; # 241| } Error: CPPCHECK_WARNING (CWE-457): [#def14] kbd-2.6.4-build/kbd-2.6.4/src/libkfont/setfont.c:510: warning[uninitvar]: Uninitialized variable: ifiles # 508| # 509| /* recursive call */ # 510|-> ret = kfont_load_fonts(ctx, fd, ifiles, ifilct, iunit, # 511| hwunit, no_m, no_u); # 512| Error: GCC_ANALYZER_WARNING (CWE-401): [#def15] kbd-2.6.4-build/kbd-2.6.4/src/openvt.c: scope_hint: In function ‘authenticate_user’ kbd-2.6.4-build/kbd-2.6.4/src/openvt.c:127:20: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir("/proc")’ kbd-2.6.4-build/kbd-2.6.4/src/openvt.c:15: included_from: Included from here. # 125| int errsv = errno; # 126| sprintf(filename, VTNAME2, curvt); # 127|-> if (stat(filename, &buf)) { # 128| /* give error message for first attempt */ # 129| sprintf(filename, VTNAME, curvt); Error: GCC_ANALYZER_WARNING (CWE-401): [#def16] kbd-2.6.4-build/kbd-2.6.4/src/openvt.c:138:12: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir("/proc")’ # 136| # 137| /* get the owner of current tty */ # 138|-> if (!(pwnam = getpwuid(console_uid))) # 139| kbd_error(EXIT_FAILURE, errno, "getpwuid"); # 140| Error: GCC_ANALYZER_WARNING (CWE-775): [#def17] kbd-2.6.4-build/kbd-2.6.4/src/openvt.c: scope_hint: In function ‘main’ kbd-2.6.4-build/kbd-2.6.4/src/openvt.c:347:41: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’ # 345| struct stat st; # 346| # 347|-> if (fstat(i, &st) == -1 && open("/dev/null", O_RDWR) == -1) # 348| kbd_error(EXIT_FAILURE, errno, "open(/dev/null)"); # 349| } Error: GCC_ANALYZER_WARNING: [#def18] kbd-2.6.4-build/kbd-2.6.4/src/openvt.c:465:22: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘0’ # 463| close(consfd); # 464| # 465|-> if ((dup2(fd, 0) == -1) || (dup2(fd, 1) == -1) || (dup2(fd, 2) == -1)) # 466| kbd_error(1, errno, "dup"); # 467| Error: GCC_ANALYZER_WARNING: [#def19] kbd-2.6.4-build/kbd-2.6.4/src/openvt.c:465:45: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘1’ # 463| close(consfd); # 464| # 465|-> if ((dup2(fd, 0) == -1) || (dup2(fd, 1) == -1) || (dup2(fd, 2) == -1)) # 466| kbd_error(1, errno, "dup"); # 467| Error: GCC_ANALYZER_WARNING: [#def20] kbd-2.6.4-build/kbd-2.6.4/src/openvt.c:465:68: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘2’ # 463| close(consfd); # 464| # 465|-> if ((dup2(fd, 0) == -1) || (dup2(fd, 1) == -1) || (dup2(fd, 2) == -1)) # 466| kbd_error(1, errno, "dup"); # 467| Error: GCC_ANALYZER_WARNING (CWE-479): [#def21] kbd-2.6.4-build/kbd-2.6.4/src/showkey.c: scope_hint: In function ‘die’ kbd-2.6.4-build/kbd-2.6.4/src/showkey.c:76:9: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘printf’ from within signal handler # 74| die(int x) # 75| { # 76|-> printf(_("caught signal %d, cleaning up...\n"), x); # 77| clean_up(); # 78| exit(EXIT_FAILURE); Error: GCC_ANALYZER_WARNING (CWE-479): [#def22] kbd-2.6.4-build/kbd-2.6.4/src/showkey.c:78:9: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘exit’ from within signal handler kbd-2.6.4-build/kbd-2.6.4/src/showkey.c:78:9: note: ‘_exit’ is a possible signal-safe alternative for ‘exit’ # 76| printf(_("caught signal %d, cleaning up...\n"), x); # 77| clean_up(); # 78|-> exit(EXIT_FAILURE); # 79| } # 80| Error: GCC_ANALYZER_WARNING (CWE-479): [#def23] kbd-2.6.4-build/kbd-2.6.4/src/showkey.c: scope_hint: In function ‘watch_dog’ kbd-2.6.4-build/kbd-2.6.4/src/showkey.c:85:9: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘exit’ from within signal handler kbd-2.6.4-build/kbd-2.6.4/src/showkey.c:85:9: note: ‘_exit’ is a possible signal-safe alternative for ‘exit’ # 83| { # 84| clean_up(); # 85|-> exit(EXIT_SUCCESS); # 86| } # 87| Error: COMPILER_WARNING (CWE-681): [#def24] kbd-2.6.4-build/kbd-2.6.4/src/showkey.c: scope_hint: In function ‘main’ kbd-2.6.4-build/kbd-2.6.4/src/showkey.c:275:31: warning[-Wsign-conversion]: conversion to ‘unsigned int’ from ‘int’ may change the sign of the result # 275 | alarm(timeout); # | ^~~~~~~ # 273| if (!show_keycodes) { # 274| while (1) { # 275|-> alarm(timeout); # 276| n = read(fd, buf, sizeof(buf)); # 277| for (i = 0; i < n; i++) Error: COMPILER_WARNING (CWE-681): [#def25] kbd-2.6.4-build/kbd-2.6.4/src/showkey.c:287:23: warning[-Wsign-conversion]: conversion to ‘unsigned int’ from ‘int’ may change the sign of the result # 287 | alarm(timeout); # | ^~~~~~~ # 285| /* show keycodes - 2.6 allows 3-byte reports */ # 286| while (1) { # 287|-> alarm(timeout); # 288| n = read(fd, buf, sizeof(buf)); # 289| i = 0; Error: COMPILER_WARNING (CWE-681): [#def26] kbd-2.6.4-build/kbd-2.6.4/tests/helpers/libkeymap-showmaps.c: scope_hint: In function ‘main’ kbd-2.6.4-build/kbd-2.6.4/tests/helpers/libkeymap-showmaps.c:36:41: warning[-Wsign-conversion]: conversion to ‘int’ from ‘unsigned int’ may change the sign of the result # 36 | if (!lk_map_exists(ctx, i)) # | ^ # 34| # 35| for (i = 0; i < ctx->keymap->total; i++) { # 36|-> if (!lk_map_exists(ctx, i)) # 37| continue; # 38| printf("keymap %03d\n", i); Error: COMPILER_WARNING (CWE-681): [#def27] kbd-2.6.4-build/kbd-2.6.4/tests/libkeymap/libkeymap-test07.c: scope_hint: In function ‘main’ kbd-2.6.4-build/kbd-2.6.4/tests/libkeymap/libkeymap-test07.c:43:41: warning[-Wsign-conversion]: conversion to ‘int’ from ‘unsigned int’ may change the sign of the result # 43 | int c = lk_get_key(ctx, i, 17); # | ^ # 41| # 42| while (i < MAX_NR_KEYMAPS) { # 43|-> int c = lk_get_key(ctx, i, 17); # 44| if (KVAL(c) != 'x') # 45| kbd_error(EXIT_FAILURE, 0, "Unable to get keycode"); Error: COMPILER_WARNING (CWE-681): [#def28] kbd-2.6.4-build/kbd-2.6.4/tests/libkeymap/libkeymap-test08.c: scope_hint: In function ‘main’ kbd-2.6.4-build/kbd-2.6.4/tests/libkeymap/libkeymap-test08.c:44:41: warning[-Wsign-conversion]: conversion to ‘int’ from ‘unsigned int’ may change the sign of the result # 44 | int c = lk_get_key(ctx, i, 17); # | ^ # 42| # 43| for (i = 0; i < 26; i++) { # 44|-> int c = lk_get_key(ctx, i, 17); # 45| if (KVAL(c) != str[i]) # 46| kbd_error(EXIT_FAILURE, 0, "Unable to get keycode"); Error: COMPILER_WARNING (CWE-192): [#def29] kbd-2.6.4-build/kbd-2.6.4/tests/libkeymap/libkeymap-test16.c: scope_hint: In function ‘main’ kbd-2.6.4-build/kbd-2.6.4/tests/libkeymap/libkeymap-test16.c:18:34: warning[-Wenum-conversion]: implicit conversion from ‘enum <anonymous>’ to ‘lk_flags’ # 18 | lk_set_parser_flags(ctx, LK_KEYWORD_ALTISMETA); # | ^~~~~~~~~~~~~~~~~~~~ # 16| ctx = lk_init(); # 17| lk_set_log_fn(ctx, NULL, NULL); # 18|-> lk_set_parser_flags(ctx, LK_KEYWORD_ALTISMETA); # 19| # 20| if (lk_add_key(ctx, 0, 0, 16) != 0)
analyzer-version-clippy | 1.82.0 |
analyzer-version-cppcheck | 2.16.0 |
analyzer-version-gcc | 14.2.1 |
analyzer-version-gcc-analyzer | 15.0.0 |
analyzer-version-shellcheck | 0.10.0 |
analyzer-version-unicontrol | 0.0.2 |
enabled-plugins | clippy, cppcheck, gcc, shellcheck, unicontrol |
exit-code | 0 |
host | ip-172-16-1-145.us-west-2.compute.internal |
mock-config | fedora-rawhide-gcc-latest-x86_64 |
project-name | kbd-2.6.4-5.fc42 |
store-results-to | /tmp/tmpj31x_4uv/kbd-2.6.4-5.fc42.tar.xz |
time-created | 2024-11-13 00:30:35 |
time-finished | 2024-11-13 00:33:12 |
tool | csmock |
tool-args | '/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpj31x_4uv/kbd-2.6.4-5.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpj31x_4uv/kbd-2.6.4-5.fc42.src.rpm' |
tool-version | csmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9 |