Fixed findings

List of Findings

Error: COMPILER_WARNING (CWE-704): [#def1]
tmux-3.5a/compat/getopt.c: scope_hint: In function ‘BSDgetopt’
tmux-3.5a/compat/getopt.c:76:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
#   76 |             !(oli = strchr(ostr, BSDoptopt))) {
#      |                   ^
#   74|   	}					/* option letter okay? */
#   75|   	if ((BSDoptopt = (int)*place++) == (int)':' ||
#   76|-> 	    !(oli = strchr(ostr, BSDoptopt))) {
#   77|   		/*
#   78|   		 * if the user didn't specify '-' as an option,

Error: COMPILER_WARNING (CWE-704): [#def2]
tmux-3.5a/compat/getopt.c:76:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
#   74|   	}					/* option letter okay? */
#   75|   	if ((BSDoptopt = (int)*place++) == (int)':' ||
#   76|-> 	    !(oli = strchr(ostr, BSDoptopt))) {
#   77|   		/*
#   78|   		 * if the user didn't specify '-' as an option,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
tmux-3.5a/compat/imsg.c:80:13: warning[-Wanalyzer-malloc-leak]: leak of ‘ifd’
tmux-3.5a/compat/imsg.c:76:20: acquire_memory: allocated here
tmux-3.5a/compat/imsg.c:76:12: branch_false: following ‘false’ branch (when ‘ifd’ is non-NULL)...
tmux-3.5a/compat/imsg.c:76:12: branch_false: ...to here
tmux-3.5a/compat/imsg.c:80:13: throw: if ‘getdtablecount’ throws an exception...
tmux-3.5a/compat/imsg.c:80:13: danger: ‘ifd’ leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   78|   
#   79|   again:
#   80|-> 	if (getdtablecount() + imsg_fd_overhead +
#   81|   	    (int)((CMSG_SPACE(sizeof(int))-CMSG_SPACE(0))/sizeof(int))
#   82|   	    >= getdtablesize()) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
tmux-3.5a/compat/imsg.c:88:18: warning[-Wanalyzer-malloc-leak]: leak of ‘ifd’
tmux-3.5a/compat/imsg.c:76:20: acquire_memory: allocated here
tmux-3.5a/compat/imsg.c:76:12: branch_false: following ‘false’ branch (when ‘ifd’ is non-NULL)...
tmux-3.5a/compat/imsg.c:76:12: branch_false: ...to here
tmux-3.5a/compat/imsg.c:80:12: branch_false: following ‘false’ branch...
tmux-3.5a/compat/imsg.c:88:18: branch_false: ...to here
tmux-3.5a/compat/imsg.c:88:18: throw: if ‘recvmsg’ throws an exception...
tmux-3.5a/compat/imsg.c:88:18: danger: ‘ifd’ leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#   86|   	}
#   87|   
#   88|-> 	if ((n = recvmsg(imsgbuf->fd, &msg, 0)) == -1) {
#   89|   		if (errno == EINTR)
#   90|   			goto again;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def5]
tmux-3.5a/grid.c:1286:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘from’
tmux-3.5a/grid.c:1378:1: enter_function: entry to ‘grid_reflow’
tmux-3.5a/grid.c:1389:18: call_function: calling ‘grid_create’ from ‘grid_reflow’
tmux-3.5a/grid.c:1389:18: return_function: returning to ‘grid_reflow’ from ‘grid_create’
tmux-3.5a/grid.c:1394:22: branch_true: following ‘true’ branch...
tmux-3.5a/grid.c:1395:23: branch_true: ...to here
tmux-3.5a/grid.c:1424:20: branch_false: following ‘false’ branch (when ‘width != sx’)...
tmux-3.5a/grid.c:1433:20: branch_false: ...to here
tmux-3.5a/grid.c:1433:20: branch_false: following ‘false’ branch (when ‘width <= sx’)...
tmux-3.5a/grid.c:1442:21: branch_false: ...to here
tmux-3.5a/grid.c:1442:20: branch_true: following ‘true’ branch...
tmux-3.5a/grid.c:1443:25: branch_true: ...to here
tmux-3.5a/grid.c:1443:25: call_function: calling ‘grid_reflow_join’ from ‘grid_reflow’
# 1284|   	 * remove the wrap flag from this line.
# 1285|   	 */
# 1286|-> 	left = from->cellused - want;
# 1287|   	if (left != 0) {
# 1288|   		grid_move_cells(gd, 0, want, yy + lines, left, 8);

Error: COMPILER_WARNING (CWE-457): [#def6]
tmux-3.5a/image-sixel.c: scope_hint: In function ‘sixel_print’
tmux-3.5a/image-sixel.c:549:25: warning[-Wmaybe-uninitialized]: ‘data’ may be used uninitialized
#  549 |                         sixel_print_repeat(&buf, &len, &used, count, data);
#      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tmux-3.5a/image-sixel.c:480:59: note: ‘data’ was declared here
#  480 |         char                    *buf, tmp[64], *contains, data, last = 0;
#      |                                                           ^~~~
#  547|   					count++;
#  548|   			}
#  549|-> 			sixel_print_repeat(&buf, &len, &used, count, data);
#  550|   			sixel_print_add(&buf, &len, &used, "$", 1);
#  551|   		}

Error: COMPILER_WARNING (CWE-681): [#def7]
tmux-3.5a/input.c: scope_hint: In function ‘input_dcs_dispatch’
tmux-3.5a/input.c:2336:34: warning[-Wpointer-sign]: pointer targets in passing argument 1 of ‘sixel_parse’ differ in signedness
# 2336 |                 si = sixel_parse(buf, len, w->xpixel, w->ypixel);
#      |                                  ^~~
#      |                                  |
#      |                                  u_char * {aka unsigned char *}
tmux-3.5a/input.c:29: included_from: Included from here.
tmux-3.5a/tmux.h:3485:33: note: expected ‘const char *’ but argument is of type ‘u_char *’ {aka ‘unsigned char *’}
# 3485 | struct sixel_image *sixel_parse(const char *, size_t, u_int, u_int);
#      |                                 ^~~~~~~~~~~~
# 2334|   	w = wp->window;
# 2335|   	if (buf[0] == 'q') {
# 2336|-> 		si = sixel_parse(buf, len, w->xpixel, w->ypixel);
# 2337|   		if (si != NULL)
# 2338|   			screen_write_sixelimage(sctx, si, ictx->cell.cell.bg);

Error: COMPILER_WARNING (CWE-681): [#def8]
tmux-3.5a/input.c: scope_hint: In function ‘input_exit_apc’
tmux-3.5a/input.c:2472:43: warning[-Wpointer-sign]: pointer targets in passing argument 2 of ‘screen_set_title’ differ in signedness
# 2472 |         if (screen_set_title(sctx->s, ictx->input_buf) && wp != NULL) {
#      |                                       ~~~~^~~~~~~~~~~
#      |                                           |
#      |                                           u_char * {aka unsigned char *}
tmux-3.5a/tmux.h:3061:44: note: expected ‘const char *’ but argument is of type ‘u_char *’ {aka ‘unsigned char *’}
# 3061 | int      screen_set_title(struct screen *, const char *);
#      |                                            ^~~~~~~~~~~~
# 2470|   	log_debug("%s: \"%s\"", __func__, ictx->input_buf);
# 2471|   
# 2472|-> 	if (screen_set_title(sctx->s, ictx->input_buf) && wp != NULL) {
# 2473|   		notify_pane("pane-title-changed", wp);
# 2474|   		server_redraw_window_borders(wp->window);

Error: CPPCHECK_WARNING (CWE-457): [#def9]
tmux-3.5a/screen-write.c:1860: warning[uninitvar]: Uninitialized variable: gc.data.width
# 1858|   			    &grid_default_cell);
# 1859|   		}
# 1860|-> 		if (gc.data.width > 1) {
# 1861|   			grid_view_set_cell(s->grid, xx, s->cy,
# 1862|   			    &grid_default_cell);

Error: COMPILER_WARNING (CWE-704): [#def10]
tmux-3.5a/utf8.c: scope_hint: In function ‘utf8_in_table’
tmux-3.5a/utf8.c:309:15: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
#  309 |         found = bsearch(&find, table, count, sizeof *table, utf8_table_cmp);
#      |               ^
#  307|   	wchar_t	*found;
#  308|   
#  309|-> 	found = bsearch(&find, table, count, sizeof *table, utf8_table_cmp);
#  310|   	return (found != NULL);
#  311|   }

Error: COMPILER_WARNING (CWE-704): [#def11]
tmux-3.5a/utf8.c:309:15: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
#  307|   	wchar_t	*found;
#  308|   
#  309|-> 	found = bsearch(&find, table, count, sizeof *table, utf8_table_cmp);
#  310|   	return (found != NULL);
#  311|   }

Scan Properties

analyzer-version-clippy1.92.0
analyzer-version-cppcheck2.19.1
analyzer-version-gcc16.0.0
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.92.0
diffbase-analyzer-version-cppcheck2.19.1
diffbase-analyzer-version-gcc16.0.0
diffbase-analyzer-version-gcc-analyzer16.0.0
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-109.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.20250521.132812.g8eff701.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-nametmux-3.6-1.fc44
diffbase-store-results-to/tmp/tmpvkajpcdh/tmux-3.6-1.fc44.tar.xz
diffbase-time-created2026-01-08 21:55:00
diffbase-time-finished2026-01-08 21:57:10
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpvkajpcdh/tmux-3.6-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpvkajpcdh/tmux-3.6-1.fc44.src.rpm'
diffbase-tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-109.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-nametmux-3.5a-5.fc43
store-results-to/tmp/tmpm2pxz4u_/tmux-3.5a-5.fc43.tar.xz
time-created2026-01-08 21:51:56
time-finished2026-01-08 21:54:35
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpm2pxz4u_/tmux-3.5a-5.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpm2pxz4u_/tmux-3.5a-5.fc43.src.rpm'
tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9