Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1]
gawk-5.3.2/awkgram.y:6106:21: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
gawk-5.3.2/awkgram.y:6077:1: enter_function: entry to ‘mk_getline’
gawk-5.3.2/awkgram.y:6101:12: branch_true: following ‘true’ branch (when ‘var’ is non-NULL)...
gawk-5.3.2/awkgram.y:6102:38: branch_true: ...to here
gawk-5.3.2/awkgram.y:6102:22: call_function: inlined call to ‘make_assignable’ from ‘mk_getline’
gawk-5.3.2/awkgram.y:6106:21: danger: dereference of NULL ‘<unknown>’
# 6104|   
# 6105|   		/* check if we need after_assign bytecode */
# 6106|-> 		if (tp->opcode == Op_push_lhs
# 6107|   				&& tp->memory->type == Node_var
# 6108|   				&& tp->memory->var_assign

Error: COMPILER_WARNING: [#def2]
gawk-5.3.2/extension/readdir.c: scope_hint: In function 'dir_get_record'
gawk-5.3.2/extension/readdir.c:221:27: warning[-Warray-bounds=]: array subscript 1 is above array bounds of 'struct awk_field_info[1]'
#  221 |         the_dir->fw.fields[1].len = flen-1;
#      |         ~~~~~~~~~~~~~~~~~~^~~
gawk-5.3.2/extension/readdir.c:65: included_from: Included from here.
gawk-5.3.2/gawkapi.h:142:11: note: while referencing 'fields'
#  142 |         } fields[1];            /* actual dimension should be nf */
#      |           ^~~~~~
#  219|   	the_dir->fw.fields[0].len = len;
#  220|   	len += (flen = sprintf(the_dir->buf + len, "/%s", dirent->d_name));
#  221|-> 	the_dir->fw.fields[1].len = flen-1;
#  222|   
#  223|   	ftstr = ftype(dirent, iobuf->name);

Error: COMPILER_WARNING: [#def3]
gawk-5.3.2/extension/readdir.c:225:27: warning[-Warray-bounds=]: array subscript 2 is above array bounds of 'struct awk_field_info[1]'
#  225 |         the_dir->fw.fields[2].len = flen-1;
#      |         ~~~~~~~~~~~~~~~~~~^~~
gawk-5.3.2/gawkapi.h:142:11: note: while referencing 'fields'
#  142 |         } fields[1];            /* actual dimension should be nf */
#      |           ^~~~~~
#  223|   	ftstr = ftype(dirent, iobuf->name);
#  224|   	len += (flen = sprintf(the_dir->buf + len, "/%s", ftstr));
#  225|-> 	the_dir->fw.fields[2].len = flen-1;
#  226|   
#  227|   	*out = the_dir->buf;

Error: COMPILER_WARNING: [#def4]
gawk-5.3.2/extension/readdir.c: scope_hint: In function 'dir_take_control_of'
gawk-5.3.2/extension/readdir.c:303:27: warning[-Warray-bounds=]: array subscript 1 is above array bounds of 'struct awk_field_info[1]'
#  303 |         the_dir->fw.fields[1].skip = 1; /* single '/' separator */
#      |         ~~~~~~~~~~~~~~~~~~^~~
gawk-5.3.2/gawkapi.h:142:11: note: while referencing 'fields'
#  142 |         } fields[1];            /* actual dimension should be nf */
#      |           ^~~~~~
#  301|   	the_dir->fw.nf = 3;
#  302|   	the_dir->fw.fields[0].skip = 0;	/* no leading space */
#  303|-> 	the_dir->fw.fields[1].skip = 1;	/* single '/' separator */
#  304|   	the_dir->fw.fields[2].skip = 1;	/* single '/' separator */
#  305|   	size = sizeof(struct dirent) + 21 /* max digits in inode */ + 2 /* slashes */;

Error: COMPILER_WARNING: [#def5]
gawk-5.3.2/extension/readdir.c:304:27: warning[-Warray-bounds=]: array subscript 2 is above array bounds of 'struct awk_field_info[1]'
#  304 |         the_dir->fw.fields[2].skip = 1; /* single '/' separator */
#      |         ~~~~~~~~~~~~~~~~~~^~~
gawk-5.3.2/gawkapi.h:142:11: note: while referencing 'fields'
#  142 |         } fields[1];            /* actual dimension should be nf */
#      |           ^~~~~~
#  302|   	the_dir->fw.fields[0].skip = 0;	/* no leading space */
#  303|   	the_dir->fw.fields[1].skip = 1;	/* single '/' separator */
#  304|-> 	the_dir->fw.fields[2].skip = 1;	/* single '/' separator */
#  305|   	size = sizeof(struct dirent) + 21 /* max digits in inode */ + 2 /* slashes */;
#  306|   	emalloc(the_dir->buf, char *, size, "dir_take_control_of");

Error: GCC_ANALYZER_WARNING (CWE-476): [#def6]
gawk-5.3.2/gawkapi.c:870:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
gawk-5.3.2/gawkapi.c:829:1: enter_function: entry to ‘api_sym_update’
gawk-5.3.2/gawkapi.c:862:16: call_function: calling ‘ns_lookup’ from ‘api_sym_update’
gawk-5.3.2/gawkapi.c:862:16: return_function: returning to ‘api_sym_update’ from ‘ns_lookup’
gawk-5.3.2/gawkapi.c:864:12: branch_true: following ‘true’ branch...
gawk-5.3.2/gawkapi.c:866:21: branch_true: ...to here
gawk-5.3.2/gawkapi.c:866:20: branch_true: following ‘true’ branch...
gawk-5.3.2/gawkapi.c:867:38: branch_true: ...to here
gawk-5.3.2/gawkapi.c:867:38: call_function: calling ‘awk_value_to_node’ from ‘api_sym_update’
gawk-5.3.2/gawkapi.c:867:38: return_function: returning to ‘api_sym_update’ from ‘awk_value_to_node’
gawk-5.3.2/gawkapi.c:870:25: danger: dereference of NULL ‘awk_value_to_node(value)’
#  868|   			node = install_symbol(full_name, Node_var_array);
#  869|   			array_node->vname = node->vname;
#  870|-> 			*node = *array_node;
#  871|   			freenode(array_node);
#  872|   			value->array_cookie = node;	/* pass new cookie back to extension */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def7]
gawk-5.3.2/gawkapi.c:902:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
gawk-5.3.2/gawkapi.c:829:1: enter_function: entry to ‘api_sym_update’
gawk-5.3.2/gawkapi.c:862:16: call_function: calling ‘ns_lookup’ from ‘api_sym_update’
gawk-5.3.2/gawkapi.c:862:16: return_function: returning to ‘api_sym_update’ from ‘ns_lookup’
gawk-5.3.2/gawkapi.c:864:12: branch_false: following ‘false’ branch...
gawk-5.3.2/gawkapi.c:887:17: branch_false: ...to here
gawk-5.3.2/gawkapi.c:887:12: branch_false: following ‘false’ branch...
gawk-5.3.2/gawkapi.c:888:16: branch_false: ...to here
gawk-5.3.2/gawkapi.c:887:16: branch_false: following ‘false’ branch...
gawk-5.3.2/gawkapi.c:894:9: branch_false: ...to here
gawk-5.3.2/gawkapi.c:896:12: branch_true: following ‘true’ branch...
gawk-5.3.2/gawkapi.c:897:21: branch_true: ...to here
gawk-5.3.2/gawkapi.c:897:20: branch_true: following ‘true’ branch...
gawk-5.3.2/gawkapi.c:899:38: branch_true: ...to here
gawk-5.3.2/gawkapi.c:899:38: call_function: calling ‘awk_value_to_node’ from ‘api_sym_update’
gawk-5.3.2/gawkapi.c:899:38: return_function: returning to ‘api_sym_update’ from ‘awk_value_to_node’
gawk-5.3.2/gawkapi.c:901:25: call_function: inlined call to ‘unref’ from ‘api_sym_update’
gawk-5.3.2/gawkapi.c:902:25: branch_false: ...to here
gawk-5.3.2/gawkapi.c:902:25: danger: dereference of NULL ‘awk_value_to_node(value)’
#  900|   			array_node->vname = node->vname;
#  901|   			unref(node->var_value);
#  902|-> 			*node = *array_node;
#  903|   			freenode(array_node);
#  904|   			value->array_cookie = node;	/* pass new cookie back to extension */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def8]
gawk-5.3.2/gawkapi.c:1105:13: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
# 1103|   	tmp = awk_value_to_node(index);
# 1104|   	elem = awk_value_to_node(value);
# 1105|-> 	if (elem->type == Node_var_array) {
# 1106|   		elem->parent_array = array;
# 1107|   		elem->vname = estrdup(index->str_value.str,

Error: GCC_ANALYZER_WARNING (CWE-775): [#def9]
gawk-5.3.2/io.c:689:16: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘ret’
gawk-5.3.2/io.c:2822:1: enter_function: entry to ‘do_getline_redir’
gawk-5.3.2/io.c:2835:12: branch_false: following ‘false’ branch (when ‘into_variable == 0’)...
gawk-5.3.2/io.c:2839:21: branch_false: ...to here
gawk-5.3.2/io.c:2840:14: call_function: calling ‘redirect’ from ‘do_getline_redir’
#  687|   	}
#  688|   	efree(iop);
#  689|-> 	return ret == -1 ? 1 : 0;
#  690|   }
#  691|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def10]
gawk-5.3.2/io.c:2704:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup(p[1])’
gawk-5.3.2/io.c:2822:1: enter_function: entry to ‘do_getline_redir’
gawk-5.3.2/io.c:2835:12: branch_false: following ‘false’ branch (when ‘into_variable == 0’)...
gawk-5.3.2/io.c:2839:21: branch_false: ...to here
gawk-5.3.2/io.c:2840:14: call_function: calling ‘redirect’ from ‘do_getline_redir’
# 2702|   			fatal(_("close of stdout in child failed: %s"),
# 2703|   				strerror(errno));
# 2704|-> 		if (dup(p[1]) != 1)
# 2705|   			fatal(_("moving pipe to stdout in child failed (dup: %s)"), strerror(errno));
# 2706|   		if (close(p[0]) == -1 || close(p[1]) == -1)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def11]
gawk-5.3.2/io.c:2704:21: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘p[1]’
gawk-5.3.2/io.c:2822:1: enter_function: entry to ‘do_getline_redir’
gawk-5.3.2/io.c:2835:12: branch_false: following ‘false’ branch (when ‘into_variable == 0’)...
gawk-5.3.2/io.c:2839:21: branch_false: ...to here
gawk-5.3.2/io.c:2840:14: call_function: calling ‘redirect’ from ‘do_getline_redir’
# 2702|   			fatal(_("close of stdout in child failed: %s"),
# 2703|   				strerror(errno));
# 2704|-> 		if (dup(p[1]) != 1)
# 2705|   			fatal(_("moving pipe to stdout in child failed (dup: %s)"), strerror(errno));
# 2706|   		if (close(p[0]) == -1 || close(p[1]) == -1)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def12]
gawk-5.3.2/io.c:2715:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘p[0]’
gawk-5.3.2/io.c:2822:1: enter_function: entry to ‘do_getline_redir’
gawk-5.3.2/io.c:2835:12: branch_false: following ‘false’ branch (when ‘into_variable == 0’)...
gawk-5.3.2/io.c:2839:21: branch_false: ...to here
gawk-5.3.2/io.c:2840:14: call_function: calling ‘redirect’ from ‘do_getline_redir’
# 2713|   
# 2714|   	if (pid == -1) {
# 2715|-> 		close(p[0]); close(p[1]);
# 2716|   		fatal(_("cannot create child process for `%s' (fork: %s)"), cmd, strerror(errno));
# 2717|   	}

Error: COMPILER_WARNING: [#def13]
gawk-5.3.2/main.c: scope_hint: In function ‘init_fds’
gawk-5.3.2/main.c:1383:13: warning[-Wunused-but-set-variable=]: variable ‘newfd’ set but not used
# 1383 |         int newfd;
#      |             ^~~~~
# 1381|   	struct stat sbuf;
# 1382|   	int fd;
# 1383|-> 	int newfd;
# 1384|   	char const *const opposite_mode[] = {"w", "r", "r"};
# 1385|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def14]
gawk-5.3.2/str_array.c:853:18: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
#  851|   	assert(val != NULL);
#  852|   
#  853|-> 	newval = (*val)->stptr;
#  854|   	if (newval == NULL)
#  855|   		newval = "";

Error: COMPILER_WARNING (CWE-704): [#def15]
gawk-5.3.2/support/dfa.c: scope_hint: In function ‘comsubs’
gawk-5.3.2/support/dfa.c:4060:19: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 4060 |       char *rcp = strchr (right, *lcp);
#      |                   ^~~~~~
# 4058|       {
# 4059|         idx_t len = 0;
# 4060|->       char *rcp = strchr (right, *lcp);
# 4061|         while (rcp != NULL)
# 4062|           {

Error: COMPILER_WARNING (CWE-704): [#def16]
gawk-5.3.2/support/dfa.c:4060:19: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 4058|       {
# 4059|         idx_t len = 0;
# 4060|->       char *rcp = strchr (right, *lcp);
# 4061|         while (rcp != NULL)
# 4062|           {

Error: COMPILER_WARNING: [#def17]
gawk-5.3.2/support/pma.c: scope_hint: In function ‘integrity_check’
gawk-5.3.2/support/pma.c:229:21: warning[-Wunused-but-set-variable=]: variable ‘nrev’ set but not used
#  229 |       int nfwd = 0, nrev = 0;  // count how many we find going forward and reverse
#      |                     ^~~~
#  227|         assert(f->fnext == f);
#  228|       else {
#  229|->       int nfwd = 0, nrev = 0;  // count how many we find going forward and reverse
#  230|         for (p = f->fnext; p != f; p = p->fnext) { nfwd++; assert(VAF(p)); assert(0 == getbit(p, IU)); }
#  231|         for (p = f->fprev; p != f; p = p->fprev) { nrev++; assert(VAF(p)); assert(0 == getbit(p, IU)); }

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-124.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-namegawk-5.4.1-1.fc45
diffbase-store-results-to/tmp/tmpbh27o2dw/gawk-5.4.1-1.fc45.tar.xz
diffbase-time-created2026-08-03 14:23:28
diffbase-time-finished2026-08-03 14:26:57
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,clippy,unicontrol,shellcheck,cppcheck' '-o' '/tmp/tmpbh27o2dw/gawk-5.4.1-1.fc45.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpbh27o2dw/gawk-5.4.1-1.fc45.src.rpm'
diffbase-tool-versioncsmock-3.8.7.HEAD-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-124.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-namegawk-5.3.2-3.fc44
store-results-to/tmp/tmpjalknikk/gawk-5.3.2-3.fc44.tar.xz
time-created2026-08-03 14:18:41
time-finished2026-08-03 14:23:03
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,clippy,unicontrol,shellcheck,cppcheck' '-o' '/tmp/tmpjalknikk/gawk-5.3.2-3.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpjalknikk/gawk-5.3.2-3.fc44.src.rpm'
tool-versioncsmock-3.8.7.HEAD-1.el9