gawk-5.3.2-3.fc44

List of Findings

Error: SHELLCHECK_WARNING (CWE-758): [#def1]
/etc/profile.d/gawk.sh:1:1: error[SC2148]: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
#    1|-> gawkpath_default () {
#    2|   	unset AWKPATH
#    3|   	export AWKPATH=`gawk 'BEGIN {print ENVIRON["AWKPATH"]}'`

Error: SHELLCHECK_WARNING (CWE-571): [#def2]
/etc/profile.d/gawk.sh:3:9: warning[SC2155]: Declare and assign separately to avoid masking return values.
#    1|   gawkpath_default () {
#    2|   	unset AWKPATH
#    3|-> 	export AWKPATH=`gawk 'BEGIN {print ENVIRON["AWKPATH"]}'`
#    4|   }
#    5|   

Error: SHELLCHECK_WARNING (CWE-571): [#def3]
/etc/profile.d/gawk.sh:18:9: warning[SC2155]: Declare and assign separately to avoid masking return values.
#   16|   gawklibpath_default () {
#   17|   	unset AWKLIBPATH
#   18|-> 	export AWKLIBPATH=`gawk 'BEGIN {print ENVIRON["AWKLIBPATH"]}'`
#   19|   }
#   20|   

Error: SHELLCHECK_WARNING (CWE-480): [#def4]
/usr/bin/gawkbug:53:9: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
#   51|   VERSTR="GNU gawkbug, version ${VERSION}"
#   52|   
#   53|-> do_help= do_version=
#   54|   
#   55|   while [ $# -gt 0 ]

Error: SHELLCHECK_WARNING (CWE-480): [#def5]
/usr/bin/gawkbug:102:6: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
#  100|   case "$N" in
#  101|   *c)	n=-n c= ;;
#  102|-> *)	n= c='\c' ;;
#  103|   esac
#  104|   

Error: SHELLCHECK_WARNING (CWE-456): [#def6]
/usr/bin/gawkbug:146:3: warning[SC2209]: Use var=$(command) to assign output (or quote to assign string).
#  144|   	elif [ -x /usr/bin/vi ]
#  145|   	then
#  146|-> 		DEFEDITOR=vi
#  147|   	else
#  148|   		echo "$0: No default editor found: attempting to use vi" >&2

Error: SHELLCHECK_WARNING (CWE-456): [#def7]
/usr/bin/gawkbug:149:3: warning[SC2209]: Use var=$(command) to assign output (or quote to assign string).
#  147|   	else
#  148|   		echo "$0: No default editor found: attempting to use vi" >&2
#  149|-> 		DEFEDITOR=vi
#  150|   	fi
#  151|   fi

Error: SHELLCHECK_WARNING (CWE-398): [#def8]
/usr/bin/gawkbug:158:40: warning[SC2172]: Trapping signals by number is not well defined. Prefer signal names.
#  156|   : ${USER=${LOGNAME-`whoami`}}
#  157|   
#  158|-> trap 'rm -rf "$TEMPDIR"; exit 1' 1 2 3 13 15
#  159|   trap 'rm -rf "$TEMPDIR"' 0
#  160|   

Error: CPPCHECK_WARNING (CWE-823): [#def9]
gawk-5.3.2/array.c:1436: error[arrayIndexOutOfBounds]: Array 'sort_funcs[11]' accessed at index 11, which is out of bounds.
# 1434|   
# 1435|   	if (qi < j) {
# 1436|-> 		cmp_func = sort_funcs[qi].comp_func;
# 1437|   		assoc_kind = sort_funcs[qi].kind;
# 1438|   

Error: CPPCHECK_WARNING (CWE-823): [#def10]
gawk-5.3.2/array.c:1437: error[arrayIndexOutOfBounds]: Array 'sort_funcs[11]' accessed at index 11, which is out of bounds.
# 1435|   	if (qi < j) {
# 1436|   		cmp_func = sort_funcs[qi].comp_func;
# 1437|-> 		assoc_kind = sort_funcs[qi].kind;
# 1438|   
# 1439|   		if (symbol->array_funcs != & cint_array_func)

Error: CPPCHECK_WARNING (CWE-457): [#def11]
gawk-5.3.2/awkgram.y:3394: warning[uninitvar]: Uninitialized variable: tmp_state
# 3392|   					0 : work_ring_idx + 1;
# 3393|   			}
# 3394|-> 			cur_mbstate = tmp_state;
# 3395|   
# 3396|   			/* Put a mark on the position on which we write next character.  */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def12]
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: CPPCHECK_WARNING (CWE-476): [#def13]
gawk-5.3.2/awkgram.y:6402: error[ctunullpointer]: Null pointer dereference: l
# 6400|   		cant_happen("unexpected value %s for opcode", opcode2str(l->opcode));
# 6401|   #endif
# 6402|-> 	l->lasti->nexti = x;
# 6403|   	l->lasti = x;
# 6404|   	return l;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def14]
gawk-5.3.2/builtin.c:3279:16: warning[-Wanalyzer-null-argument]: use of NULL ‘res’ where non-null expected
# 3277|   	if (deref)
# 3278|   		DEREF(arg);
# 3279|-> 	return make_string(res, strlen(res));
# 3280|   }
# 3281|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def15]
gawk-5.3.2/cint_array.c:1260:15: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
gawk-5.3.2/cint_array.c:1257:1: enter_function: entry to ‘argv_store’
gawk-5.3.2/cint_array.c:1259:22: call_function: calling ‘cint_exists’ from ‘argv_store’
gawk-5.3.2/cint_array.c:1259:22: return_function: returning to ‘argv_store’ from ‘cint_exists’
gawk-5.3.2/cint_array.c:1260:15: danger: dereference of NULL ‘cint_exists(symbol,  subs)’
# 1258|   {
# 1259|   	NODE **val = cint_exists(symbol, subs);
# 1260|-> 	NODE *newval = *val;
# 1261|   	char *cp;
# 1262|   

Error: GCC_ANALYZER_WARNING (CWE-457): [#def16]
gawk-5.3.2/command.c:1406:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘yyss’
gawk-5.3.2/command.c:1364:6: branch_true: following ‘true’ branch...
gawk-5.3.2/command.c:1370:28: branch_true: ...to here
gawk-5.3.2/command.c:1393:10: branch_false: following ‘false’ branch (when ‘yystacksize <= 9999’)...
gawk-5.3.2/command.c:1395:7: branch_false: ...to here
gawk-5.3.2/command.c:1404:12: branch_false: following ‘false’ branch...
gawk-5.3.2/command.c:1406:9: branch_false: ...to here
gawk-5.3.2/command.c:1406:9: danger: use of uninitialized value ‘yyss’ here
# 1404|           if (! yyptr)
# 1405|             YYNOMEM;
# 1406|->         YYSTACK_RELOCATE (yyss_alloc, yyss);
# 1407|           YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# 1408|   #  undef YYSTACK_RELOCATE

Error: GCC_ANALYZER_WARNING (CWE-457): [#def17]
gawk-5.3.2/command.c:1533:3: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
gawk-5.3.2/command.c:1364:6: branch_false: following ‘false’ branch...
gawk-5.3.2/command.c:1428:6: branch_false: ...to here
gawk-5.3.2/command.c:1428:6: branch_false: following ‘false’ branch (when ‘yystate != 2’)...
gawk-5.3.2/command.c:1431:3: branch_false: ...to here
gawk-5.3.2/command.c:1443:6: branch_true: following ‘true’ branch (when ‘yyn == -151’)...
gawk-5.3.2/command.c:1444:5: branch_true: ...to here
gawk-5.3.2/command.c:1513:6: branch_false: following ‘false’ branch (when ‘yyn != 0’)...
gawk-5.3.2/command.c:1515:3: branch_false: ...to here
gawk-5.3.2/command.c:1533:3: danger: use of uninitialized value ‘*<unknown>’ here
# 1531|        unconditionally makes the parser a bit smaller, and it avoids a
# 1532|        GCC warning that YYVAL may be used uninitialized.  */
# 1533|->   yyval = yyvsp[1-yylen];
# 1534|   
# 1535|   

Error: CPPCHECK_WARNING (CWE-476): [#def18]
gawk-5.3.2/command.y:792: warning[nullPointer]: Possible null pointer dereference: stmt_list
#  790|   
#  791|   	len = strlen(stmt) + 1;	/* 1 for newline */
#  792|-> 	s = stmt_list->a_string;
#  793|   	slen = strlen(s);
#  794|   	ssize = stmt_list->a_count;

Error: CPPCHECK_WARNING (CWE-476): [#def19]
gawk-5.3.2/command.y:794: warning[nullPointer]: Possible null pointer dereference: stmt_list
#  792|   	s = stmt_list->a_string;
#  793|   	slen = strlen(s);
#  794|-> 	ssize = stmt_list->a_count;
#  795|   	if (len > ssize - slen) {
#  796|   		ssize = slen + len + EVALSIZE;

Error: CPPCHECK_WARNING (CWE-476): [#def20]
gawk-5.3.2/command.y:1706: warning[nullPointer]: Possible null pointer dereference: vars
# 1704|   
# 1705|   	/* globals */
# 1706|-> 	while ((r = vars[idx++]) != NULL) {
# 1707|   		name = r->vname;
# 1708|   		if (strncmp(name, text, textlen) == 0)

Error: CPPCHECK_WARNING (CWE-457): [#def21]
gawk-5.3.2/debug.c:1134: error[legacyUninitvar]: Uninitialized variable: pager_quit_tag_stack
# 1132|   	list = assoc_list((NODE *) arr, "@ind_str_asc", SORTED_IN);
# 1133|   
# 1134|-> 	PUSH_BINDING(pager_quit_tag_stack, pager_quit_tag, pager_quit_tag_valid);
# 1135|   	if (setjmp(pager_quit_tag) == 0) {
# 1136|   		// push name onto stack

Error: CPPCHECK_WARNING (CWE-457): [#def22]
gawk-5.3.2/debug.c:5623: error[legacyUninitvar]: Uninitialized variable: fatal_tag_stack
# 5621|   	do_flags = false;
# 5622|   
# 5623|-> 	PUSH_BINDING(fatal_tag_stack, fatal_tag, fatal_tag_valid);
# 5624|   	if (setjmp(fatal_tag) == 0) {
# 5625|   		(void) interpret((INSTRUCTION *) code);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def23]
gawk-5.3.2/extension/gawkfts.c:868:33: warning[-Wanalyzer-null-argument]: use of NULL 'cp' where non-null expected
gawk-5.3.2/extension/gawkfts.c:576:1: enter_function: entry to 'gawk_fts_children'
gawk-5.3.2/extension/gawkfts.c:583:12: branch_false: following 'false' branch...
gawk-5.3.2/extension/gawkfts.c:589:9: branch_false: ...to here
gawk-5.3.2/extension/gawkfts.c:598:12: branch_false: following 'false' branch...
gawk-5.3.2/extension/gawkfts.c:602:13: branch_false: ...to here
gawk-5.3.2/extension/gawkfts.c:602:12: branch_false: following 'false' branch...
gawk-5.3.2/extension/gawkfts.c:610:12: branch_false: ...to here
gawk-5.3.2/extension/gawkfts.c:610:12: branch_false: following 'false' branch...
gawk-5.3.2/extension/gawkfts.c:614:13: branch_false: ...to here
gawk-5.3.2/extension/gawkfts.c:617:12: branch_false: following 'false' branch (when 'instr != 256')...
gawk-5.3.2/extension/gawkfts.c:630:13: branch_false: ...to here
gawk-5.3.2/extension/gawkfts.c:632:41: call_function: calling 'fts_build' from 'gawk_fts_children'
#  866|   			if (ISSET(FTS_NOCHDIR)) {
#  867|   				p->fts_accpath = p->fts_path;
#  868|-> 				memmove(cp, p->fts_name,
#  869|   				        (size_t)(p->fts_namelen + 1));
#  870|   			} else

Error: GCC_ANALYZER_WARNING (CWE-775): [#def24]
gawk-5.3.2/extension/inplace.c:191:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'dup2(mkstemp(state.tname), 1)'
gawk-5.3.2/extension/inplace.c:121:1: enter_function: entry to 'do_inplace_begin'
gawk-5.3.2/extension/inplace.c:144:13: call_function: inlined call to 'invalid_filename' from 'do_inplace_begin'
gawk-5.3.2/extension/inplace.c:151:12: branch_false: following 'false' branch...
gawk-5.3.2/extension/inplace.c:158:15: branch_false: ...to here
gawk-5.3.2/extension/inplace.c:158:12: branch_false: following 'false' branch...
gawk-5.3.2/extension/inplace.c:166:9: branch_false: ...to here
gawk-5.3.2/extension/inplace.c:188:12: branch_false: following 'false' branch...
gawk-5.3.2/extension/inplace.c:191:13: branch_false: ...to here
gawk-5.3.2/extension/inplace.c:191:13: acquire_resource: opened here
gawk-5.3.2/extension/inplace.c:191:12: danger: 'dup2(mkstemp(state.tname), 1)' leaks here; was opened at [(11)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/10)
#  189|   		fatal(ext_id, _("inplace::begin: dup(stdout) failed (%s)"),
#  190|   			strerror(errno));
#  191|-> 	if (dup2(fd, STDOUT_FILENO) < 0)
#  192|   		fatal(ext_id, _("inplace::begin: dup2(%d, stdout) failed (%s)"),
#  193|   			fd, strerror(errno));

Error: GCC_ANALYZER_WARNING (CWE-775): [#def25]
gawk-5.3.2/extension/inplace.c:226:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'dup2(state.default_stdout, 1)'
gawk-5.3.2/extension/inplace.c:216:12: branch_false: following 'false' branch...
gawk-5.3.2/extension/inplace.c:219:15: branch_false: ...to here
gawk-5.3.2/extension/inplace.c:219:12: branch_false: following 'false' branch...
gawk-5.3.2/extension/inplace.c:225:9: branch_false: ...to here
gawk-5.3.2/extension/inplace.c:226:13: acquire_resource: opened here
gawk-5.3.2/extension/inplace.c:226:12: danger: 'dup2(state.default_stdout, 1)' leaks here; was opened at [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
#  224|   
#  225|   	fflush(stdout);
#  226|-> 	if (dup2(state.default_stdout, STDOUT_FILENO) < 0)
#  227|   		fatal(ext_id, _("inplace::end: dup2(%d, stdout) failed (%s)"),
#  228|   			state.default_stdout, strerror(errno));

Error: CPPCHECK_WARNING (CWE-457): [#def26]
gawk-5.3.2/extension/intdiv.c:197: error[uninitvar]: Uninitialized variable: numer_tmp
#  195|   
#  196|   		/* convert numerator and denominator to integer */
#  197|-> 		if (!(numer = mpz_conv(&nv, numer_tmp))) {
#  198|   			warning(ext_id, _("intdiv: numerator is not finite"));
#  199|   			return make_number(-1, result);

Error: CPPCHECK_WARNING (CWE-457): [#def27]
gawk-5.3.2/extension/intdiv.c:201: error[uninitvar]: Uninitialized variable: denom_tmp
#  199|   			return make_number(-1, result);
#  200|   		}
#  201|-> 		if (!(denom = mpz_conv(&dv, denom_tmp))) {
#  202|   			warning(ext_id, _("intdiv: denominator is not finite"));
#  203|   			if (numer == numer_tmp)

Error: COMPILER_WARNING: [#def28]
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: [#def29]
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: [#def30]
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: [#def31]
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): [#def32]
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): [#def33]
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): [#def34]
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): [#def35]
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): [#def36]
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): [#def37]
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): [#def38]
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: GCC_ANALYZER_WARNING (CWE-775): [#def39]
gawk-5.3.2/io.c:4641:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup(pipefds[0])’
gawk-5.3.2/io.c:4626:12: branch_false: following ‘false’ branch...
gawk-5.3.2/io.c:4629:13: branch_false: ...to here
gawk-5.3.2/io.c:4637:12: branch_true: following ‘true’ branch (when ‘childpid == 0’)...
gawk-5.3.2/io.c:4639:24: branch_true: ...to here
gawk-5.3.2/io.c:4641:21: acquire_resource: opened here
gawk-5.3.2/io.c:4641:20: danger: ‘dup(pipefds[0])’ leaks here; was opened at [(6)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/5)
# 4639|   		(void) close(pipefds[1]);	// close write end in the child
# 4640|   		(void) close(0);
# 4641|-> 		if (dup(pipefds[0]) != 0)
# 4642|   			fatal(_("gawk_popen_write: failed to move pipe fd to standard input"));
# 4643|   		(void) close(pipefds[0]);

Error: GCC_ANALYZER_WARNING (CWE-479): [#def40]
gawk-5.3.2/main.c:1301:25: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘exit’ from within signal handler
gawk-5.3.2/main.c:211:1: enter_function: entry to ‘main’
gawk-5.3.2/main.c:223:35: call_function: calling ‘enable_pma’ from ‘main’
gawk-5.3.2/main.c:223:35: return_function: returning to ‘main’ from ‘enable_pma’
gawk-5.3.2/main.c:241:12: branch_false: following ‘false’ branch...
gawk-5.3.2/main.c:244:19: branch_false: ...to here
gawk-5.3.2/main.c:1293:12: branch_false: following ‘false’ branch (when ‘sig != 8’)...
gawk-5.3.2/main.c:1295:20: branch_false: ...to here
gawk-5.3.2/main.c:1295:19: branch_true: following ‘true’ branch...
gawk-5.3.2/main.c:1300:21: branch_true: ...to here
gawk-5.3.2/main.c:1300:20: branch_true: following ‘true’ branch...
gawk-5.3.2/main.c:1301:25: branch_true: ...to here
gawk-5.3.2/main.c:1301:25: danger: call to ‘exit’ from within signal handler
# 1299|   	) {
# 1300|   		if (errcount > 0)	// assume a syntax error corrupted our data structures
# 1301|-> 			exit(EXIT_FATAL);
# 1302|   
# 1303|   		set_loc(__FILE__, __LINE__);

Error: COMPILER_WARNING: [#def41]
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: CPPCHECK_WARNING (CWE-628): [#def42]
gawk-5.3.2/node.c:1130: error[invalidFunctionArg]: Invalid sqrt() argument nr 1. The value is -1 but the valid values are '0.0:'.
# 1128|   		if (first) {
# 1129|   			first = false;
# 1130|-> 			nan = sqrt(-1.0);
# 1131|   			inf = -log(0.0);
# 1132|   		}

Error: CPPCHECK_WARNING (CWE-628): [#def43]
gawk-5.3.2/node.c:1131: error[invalidFunctionArg]: Invalid log() argument nr 1. The value is 0 but the valid values are '4.94066e-324:'.
# 1129|   			first = false;
# 1130|   			nan = sqrt(-1.0);
# 1131|-> 			inf = -log(0.0);
# 1132|   		}
# 1133|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def44]
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): [#def45]
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): [#def46]
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 (CWE-704): [#def47]
gawk-5.3.2/support/getopt.c: scope_hint: In function ‘_getopt_internal_r’
gawk-5.3.2/support/getopt.c:845:18: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
#  845 |     char *temp = strchr (optstring, c);
#      |                  ^~~~~~
#  843|     {
#  844|       char c = *d->__nextchar++;
#  845|->     char *temp = strchr (optstring, c);
#  846|   
#  847|       /* Increment `optind' when we start to process its last character.  */

Error: COMPILER_WARNING (CWE-704): [#def48]
gawk-5.3.2/support/getopt.c:845:18: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
#  843|     {
#  844|       char c = *d->__nextchar++;
#  845|->     char *temp = strchr (optstring, c);
#  846|   
#  847|       /* Increment `optind' when we start to process its last character.  */

Error: CPPCHECK_WARNING (CWE-758): [#def49]
gawk-5.3.2/support/malloc/dynarray_emplace_enlarge.c:59: error[shiftTooManyBitsSigned]: Shifting signed 64-bit value by 63 bits is undefined behaviour
#   57|   
#   58|     size_t new_size;
#   59|->   if (INT_MULTIPLY_WRAPV (new_allocated, element_size, &new_size))
#   60|       return false;
#   61|     void *new_array;

Error: CPPCHECK_WARNING (CWE-758): [#def50]
gawk-5.3.2/support/malloc/dynarray_resize.c:45: error[shiftTooManyBitsSigned]: Shifting signed 64-bit value by 63 bits is undefined behaviour
#   43|   
#   44|     size_t new_size_bytes;
#   45|->   if (INT_MULTIPLY_WRAPV (size, element_size, &new_size_bytes))
#   46|       {
#   47|         /* Overflow.  */

Error: COMPILER_WARNING: [#def51]
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.95.0
analyzer-version-cppcheck2.20.0
analyzer-version-gcc16.1.1
analyzer-version-gcc-analyzer16.1.1
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-57.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/tmpq7a7y5h7/gawk-5.3.2-3.fc44.tar.xz
time-created2026-06-01 12:10:54
time-finished2026-06-01 12:15:07
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'shellcheck,cppcheck,clippy,unicontrol,gcc' '-o' '/tmp/tmpq7a7y5h7/gawk-5.3.2-3.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpq7a7y5h7/gawk-5.3.2-3.fc44.src.rpm'
tool-versioncsmock-3.8.5.20260529.133039.g6f3b5c6-1.el9