less-668-1.fc42

List of Findings

Error: SHELLCHECK_WARNING (CWE-758): [#def1]
/etc/profile.d/less.sh:1:1: error[SC2148]: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
#    1|-> # less initialization script (sh)
#    2|   
#    3|   # All less.*sh files should have the same semantics!

Error: SHELLCHECK_WARNING (CWE-477): [#def2]
/usr/bin/lesspipe.sh:125:19: warning[SC2166]: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
#  123|   		if [ -n "$conv" ]; then
#  124|   			env=`echo $LANG | cut -d. -f2`
#  125|-> 			if [ -n "$env" -a "$conv" != "$env" ]; then
#  126|   				iconv -f $conv -t $env "$1"
#  127|   				exit $?

Error: GCC_ANALYZER_WARNING (CWE-416): [#def3]
less-668-build/less-668/ch.c: scope_hint: In function ‘ch_delbufs’
less-668-build/less-668/ch.c:85:13: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘*thisfile.buflist.next’
less-668-build/less-668/ch.c:776:17: note: in expansion of macro ‘BUF_RM’
less-668-build/less-668/ch.c:776:17: note: in expansion of macro ‘BUF_RM’
less-668-build/less-668/ch.c:776:17: note: in expansion of macro ‘BUF_RM’
less-668-build/less-668/ch.c:776:17: note: in expansion of macro ‘BUF_RM’
less-668-build/less-668/ch.c:776:17: note: in expansion of macro ‘BUF_RM’
#   83|   
#   84|   #define BUF_RM(bn) \
#   85|-> 	(bn)->next->prev = (bn)->prev; \
#   86|   	(bn)->prev->next = (bn)->next;
#   87|   

Error: COMPILER_WARNING (CWE-252): [#def4]
less-668-build/less-668/ch.c: scope_hint: In function ‘ch_get’
less-668-build/less-668/ch.c:301:33: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
#  301 |                                 write(logfile, &bp->data[bp->datasize], (size_t) n);
#      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  299|   		{
#  300|   			if (logfile >= 0 && n > 0)
#  301|-> 				write(logfile, &bp->data[bp->datasize], (size_t) n);
#  302|   		}
#  303|   #endif

Error: COMPILER_WARNING (CWE-252): [#def5]
less-668-build/less-668/ch.c: scope_hint: In function ‘sync_logfile’
less-668-build/less-668/ch.c:429:33: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
#  429 |                                 write(logfile, bp->data, bp->datasize);
#      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  427|   			if (bp->block == block)
#  428|   			{
#  429|-> 				write(logfile, bp->data, bp->datasize);
#  430|   				wrote = TRUE;
#  431|   				break;

Error: COMPILER_WARNING (CWE-457): [#def6]
less-668-build/less-668/edit.c:607:9: warning[-Wmaybe-uninitialized]: ‘alt_filename’ may be used uninitialized
#  607 |         set_altfilename(curr_ifile, alt_filename);
#      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
less-668-build/less-668/edit.c:439:15: note: ‘alt_filename’ was declared here
#  439 |         char *alt_filename;
#      |               ^~~~~~~~~~~~
#  605|   	 */
#  606|   	curr_ifile = ifile;
#  607|-> 	set_altfilename(curr_ifile, alt_filename);
#  608|   	set_altpipe(curr_ifile, altpipe);
#  609|   	set_open(curr_ifile); /* File has been opened */

Error: COMPILER_WARNING (CWE-457): [#def7]
less-668-build/less-668/edit.c: scope_hint: In function ‘edit_ifile’
less-668-build/less-668/edit.c:611:9: warning[-Wmaybe-uninitialized]: ‘chflags’ may be used uninitialized
#  611 |         ch_init(f, chflags, nread);
#      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
less-668-build/less-668/edit.c:436:13: note: ‘chflags’ was declared here
#  436 |         int chflags;
#      |             ^~~~~~~
#  609|   	set_open(curr_ifile); /* File has been opened */
#  610|   	get_pos(curr_ifile, &initial_scrpos);
#  611|-> 	ch_init(f, chflags, nread);
#  612|   	consecutive_nulls = 0;
#  613|   	check_modelines();

Error: COMPILER_WARNING (CWE-457): [#def8]
less-668-build/less-668/edit.c:625:21: warning[-Wmaybe-uninitialized]: ‘open_filename’ may be used uninitialized
#  625 |                 if (strcmp(open_filename, "-") != 0)
#      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
less-668-build/less-668/edit.c:438:24: note: ‘open_filename’ was declared here
#  438 |         constant char *open_filename;
#      |                        ^~~~~~~~~~~~~
#  623|   #if HAVE_STAT_INO
#  624|   		/* Remember the i-number and device of the opened file. */
#  625|-> 		if (strcmp(open_filename, "-") != 0)
#  626|   		{
#  627|   			struct stat statbuf;

Error: COMPILER_WARNING (CWE-457): [#def9]
less-668-build/less-668/edit.c:660:21: warning[-Wmaybe-uninitialized]: ‘filename’ may be used uninitialized
#  660 |                 if (strcmp(filename, FAKE_HELPFILE) && strcmp(filename, FAKE_EMPTYFILE))
#      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
less-668-build/less-668/edit.c:437:24: note: ‘filename’ was declared here
#  437 |         constant char *filename;
#      |                        ^~~~~~~~
#  658|   #endif
#  659|   		hshift = 0;
#  660|-> 		if (strcmp(filename, FAKE_HELPFILE) && strcmp(filename, FAKE_EMPTYFILE))
#  661|   		{
#  662|   			char *qfilename = shell_quote(filename);

Error: CPPCHECK_WARNING (CWE-457): [#def10]
less-668-build/less-668/line.c:1697: warning[uninitvar]: Uninitialized variable: pos
# 1695|   		if ((pos = position(sline)) != NULL_POSITION)
# 1696|   			break;
# 1697|-> 	for (; sline < sc_height && pos != NULL_POSITION; sline++)
# 1698|   	{
# 1699|   		pos = forw_line(pos);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def11]
less-668-build/less-668/linenum.c: scope_hint: In function ‘add_lnum’
less-668-build/less-668/linenum.c:198:22: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
less-668-build/less-668/linenum.c: scope_hint: In function ‘add_lnum’
#  196|   			}
#  197|   		}
#  198|-> 		spare->next->prev = spare->prev;
#  199|   		spare->prev->next = spare->next;
#  200|   	}

Error: GCC_ANALYZER_WARNING: [#def12]
less-668-build/less-668/lsystem.c: scope_hint: In function ‘lsystem’
less-668-build/less-668/lsystem.c:118:17: warning[-Wanalyzer-fd-use-without-check]: ‘dup’ on possibly invalid file descriptor ‘inp’
#  116|   	if (open_tty() < 0)
#  117|   #endif
#  118|-> 		dup(inp);
#  119|   #endif
#  120|   

Error: COMPILER_WARNING (CWE-252): [#def13]
less-668-build/less-668/lsystem.c: scope_hint: In function ‘lsystem’
less-668-build/less-668/lsystem.c:118:17: warning[-Wunused-result]: ignoring return value of ‘dup’ declared with attribute ‘warn_unused_result’
#  118 |                 dup(inp);
#      |                 ^~~~~~~~
#  116|   	if (open_tty() < 0)
#  117|   #endif
#  118|-> 		dup(inp);
#  119|   #endif
#  120|   

Error: COMPILER_WARNING (CWE-252): [#def14]
less-668-build/less-668/lsystem.c:152:9: warning[-Wunused-result]: ignoring return value of ‘system’ declared with attribute ‘warn_unused_result’
#  152 |         system(p);
#      |         ^~~~~~~~~
#  150|   			p = save(cmd);
#  151|   	}
#  152|-> 	system(p);
#  153|   	free(p);
#  154|   #else

Error: GCC_ANALYZER_WARNING (CWE-1341): [#def15]
less-668-build/less-668/lsystem.c:176:9: warning[-Wanalyzer-fd-double-close]: double ‘close’ of file descriptor ‘0’
#  174|   	 * Restore standard input, reset signals, raw mode, etc.
#  175|   	 */
#  176|-> 	close(0);
#  177|   	dup(inp);
#  178|   	close(inp);

Error: GCC_ANALYZER_WARNING: [#def16]
less-668-build/less-668/lsystem.c:177:9: warning[-Wanalyzer-fd-use-without-check]: ‘dup’ on possibly invalid file descriptor ‘inp’
#  175|   	 */
#  176|   	close(0);
#  177|-> 	dup(inp);
#  178|   	close(inp);
#  179|   #endif

Error: COMPILER_WARNING (CWE-252): [#def17]
less-668-build/less-668/lsystem.c:177:9: warning[-Wunused-result]: ignoring return value of ‘dup’ declared with attribute ‘warn_unused_result’
#  177 |         dup(inp);
#      |         ^~~~~~~~
#  175|   	 */
#  176|   	close(0);
#  177|-> 	dup(inp);
#  178|   	close(inp);
#  179|   #endif

Error: CPPCHECK_WARNING (CWE-909): [#def18]
less-668-build/less-668/position.c:120: error[uninitStructMember]: Uninitialized struct member: scrpos.ln
#  118|   	pos_clear();
#  119|   	if (scrpos.pos != NULL_POSITION)
#  120|-> 		table[scrpos.ln-1] = scrpos.pos;
#  121|   }
#  122|   

Error: GCC_ANALYZER_WARNING (CWE-457): [#def19]
less-668-build/less-668/search.c: scope_hint: In function ‘add_hilite.part.0’
less-668-build/less-668/search.c:828:67: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*hl.hl_attr’
less-668-build/less-668/search.c: scope_hint: In function ‘add_hilite.part.0’
#  826|   		if (hl->hl_startpos < p->r.hl_startpos)
#  827|   		{
#  828|-> 			if (hl->hl_endpos > p->r.hl_startpos && hl->hl_attr == p->r.hl_attr)
#  829|   				hl->hl_endpos = p->r.hl_startpos;
#  830|   			if (p->left != NULL)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def20]
less-668-build/less-668/search.c:837:59: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*hl.hl_attr’
less-668-build/less-668/search.c: scope_hint: In function ‘add_hilite.part.0’
#  835|   			break;
#  836|   		}
#  837|-> 		if (hl->hl_startpos < p->r.hl_endpos && hl->hl_attr == p->r.hl_attr) {
#  838|   			hl->hl_startpos = p->r.hl_endpos;
#  839|   			if (hl->hl_startpos >= hl->hl_endpos)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def21]
less-668-build/less-668/search.c:856:23: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*hl.hl_attr’
less-668-build/less-668/search.c: scope_hint: In function ‘add_hilite.part.0’
#  854|   	 */
#  855|   	if (hl->hl_startpos < p->r.hl_startpos) {
#  856|-> 		if (hl->hl_attr == p->r.hl_attr)
#  857|   		{
#  858|   			if (hl->hl_endpos == p->r.hl_startpos)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def22]
less-668-build/less-668/search.c:878:23: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*hl.hl_attr’
less-668-build/less-668/search.c: scope_hint: In function ‘add_hilite.part.0’
#  876|   		p->prev = n;
#  877|   	} else {
#  878|-> 		if (hl->hl_attr == p->r.hl_attr)
#  879|   		{
#  880|   			if (p->r.hl_endpos == hl->hl_startpos)

Error: GCC_ANALYZER_WARNING (CWE-131): [#def23]
less-668-build/less-668/tags.c: scope_hint: In function ‘findctag’
less-668-build/less-668/tags.c:79:20: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
less-668-build/less-668/tags.c:357:17: note: in expansion of macro ‘TAG_INS’
less-668-build/less-668/tags.c:357:17: note: in expansion of macro ‘TAG_INS’
#   77|   
#   78|   #define TAG_INS(tp) \
#   79|-> 	(tp)->next = TAG_END; \
#   80|   	(tp)->prev = taglist.tl_last; \
#   81|   	taglist.tl_last->next = (tp); \

Error: GCC_ANALYZER_WARNING (CWE-416): [#def24]
less-668-build/less-668/tags.c: scope_hint: In function ‘cleantags’
less-668-build/less-668/tags.c:85:13: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘tp’
less-668-build/less-668/tags.c:102:17: note: in expansion of macro ‘TAG_RM’
less-668-build/less-668/tags.c:102:17: note: in expansion of macro ‘TAG_RM’
less-668-build/less-668/tags.c:102:17: note: in expansion of macro ‘TAG_RM’
less-668-build/less-668/tags.c:102:17: note: in expansion of macro ‘TAG_RM’
less-668-build/less-668/tags.c:102:17: note: in expansion of macro ‘TAG_RM’
#   83|   
#   84|   #define TAG_RM(tp) \
#   85|-> 	(tp)->next->prev = (tp)->prev; \
#   86|   	(tp)->prev->next = (tp)->next;
#   87|   

Error: GCC_ANALYZER_WARNING (CWE-415): [#def25]
less-668-build/less-668/tags.c:103:17: warning[-Wanalyzer-double-free]: double-‘free’ of ‘*tp.tag_file’
less-668-build/less-668/tags.c:102:17: note: in expansion of macro ‘TAG_RM’
less-668-build/less-668/tags.c:102:17: note: in expansion of macro ‘TAG_RM’
#  101|   	{
#  102|   		TAG_RM(tp);
#  103|-> 		free(tp->tag_file);
#  104|   		free(tp->tag_pattern);
#  105|   		free(tp);

Error: GCC_ANALYZER_WARNING (CWE-415): [#def26]
less-668-build/less-668/tags.c:104:17: warning[-Wanalyzer-double-free]: double-‘free’ of ‘*tp.tag_pattern’
less-668-build/less-668/tags.c:102:17: note: in expansion of macro ‘TAG_RM’
less-668-build/less-668/tags.c:102:17: note: in expansion of macro ‘TAG_RM’
#  102|   		TAG_RM(tp);
#  103|   		free(tp->tag_file);
#  104|-> 		free(tp->tag_pattern);
#  105|   		free(tp);
#  106|   	}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def27]
less-668-build/less-668/tags.c: scope_hint: In function ‘findgtag’
less-668-build/less-668/tags.c:491:24: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
#  489|   
#  490|   	if (type != T_CTAGS_X && tag == NULL)
#  491|-> 		return TAG_NOFILE;
#  492|   
#  493|   	cleantags();

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-63.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-nameless-668-1.fc42
store-results-to/tmp/tmp_ysu6czn/less-668-1.fc42.tar.xz
time-created2024-11-13 01:13:27
time-finished2024-11-13 01:14:53
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmp_ysu6czn/less-668-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp_ysu6czn/less-668-1.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9