Task #240 - bash-5.2.26-3.fc40/scan-results.err
back to task #240download
Error: SHELLCHECK_WARNING (CWE-480): /usr/bin/bashbug-64:57:9: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ). # 55| VERSTR="GNU bashbug, version ${RELEASE}.${PATCHLEVEL}-${RELSTATUS}" # 56| # 57|-> do_help= do_version= # 58| # 59| while [ $# -gt 0 ]; do Error: SHELLCHECK_WARNING (CWE-480): /usr/bin/bashbug-64:99:6: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ). # 97| case "$N" in # 98| *c) n=-n c= ;; # 99|-> *) n= c='\c' ;; # 100| esac # 101| Error: SHELLCHECK_WARNING (CWE-398): /usr/bin/bashbug-64:135:7: error[SC1073]: Couldn't parse this test expression. Fix to allow more checks. # 133| elif [ -x /usr/bin/xemacs ]; then # 134| DEFEDITOR=xemacs # 135|-> elif [ -x /usr/bin/vim; then # 136| DEFEDITOR=vim # 137| elif [ -x /usr/bin/gvim; then Error: SHELLCHECK_WARNING (CWE-398): /usr/bin/bashbug-64:135:24: error[SC1072]: Expected test to end here (don't wrap commands in []/[[]]). Fix any mentioned problems and try again. # 133| elif [ -x /usr/bin/xemacs ]; then # 134| DEFEDITOR=xemacs # 135|-> elif [ -x /usr/bin/vim; then # 136| DEFEDITOR=vim # 137| elif [ -x /usr/bin/gvim; then Error: SHELLCHECK_WARNING (CWE-252): /usr/bin/cd:2:1: warning[SC2164]: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. # 1| #!/usr/bin/sh # 2|-> builtin cd "$@" Error: SHELLCHECK_WARNING: /usr/share/doc/bash/examples/functions/array-to-string:7:4: warning[SC2288]: This is interpreted as a command name ending with ']'. Double check syntax. # 5| { # 6| (( ($# < 2) || ($# > 3) )) && { # 7|-> "$FUNCNAME: usage: $FUNCNAME arrayname stringname [separator]" # 8| return 2 # 9| } Error: SHELLCHECK_WARNING (CWE-670): /usr/share/doc/bash/examples/functions/array-to-string:7:5: warning[SC2128]: Expanding an array without an index only gives the first element. # 5| { # 6| (( ($# < 2) || ($# > 3) )) && { # 7|-> "$FUNCNAME: usage: $FUNCNAME arrayname stringname [separator]" # 8| return 2 # 9| } Error: SHELLCHECK_WARNING (CWE-670): /usr/share/doc/bash/examples/functions/array-to-string:7:23: warning[SC2128]: Expanding an array without an index only gives the first element. # 5| { # 6| (( ($# < 2) || ($# > 3) )) && { # 7|-> "$FUNCNAME: usage: $FUNCNAME arrayname stringname [separator]" # 8| return 2 # 9| } Error: SHELLCHECK_WARNING (CWE-398): /usr/share/doc/bash/examples/functions/array-to-string:13:21: error[SC1087]: Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet). # 11| local array=$1 string=$2 # 12| ((3==$#)) && [[ $3 = ? ]] && local IFS="${3}${IFS}" # 13|-> eval $string="\"\${$array[*]}\"" # 14| return 0 # 15| } Error: SHELLCHECK_WARNING (CWE-138): /usr/share/doc/bash/examples/functions/arrayops.bash:95:19: error[SC2145]: Argument mixes string and array. Use * or separate argument. # 93| aset() # 94| { # 95|-> eval "$1[\$2]=${@:3}" # 96| } # 97| Error: SHELLCHECK_WARNING: /usr/share/doc/bash/examples/functions/arrayops.bash:95:19: warning[SC2294]: eval negates the benefit of arrays. Drop eval to preserve whitespace/symbols (or eval as string). # 93| aset() # 94| { # 95|-> eval "$1[\$2]=${@:3}" # 96| } # 97| Error: SHELLCHECK_WARNING (CWE-88): /usr/share/doc/bash/examples/functions/arrayops.bash:110:14: error[SC2068]: Double quote array expansions to avoid re-splitting elements. # 108| eval local "v=(\"\${$1[@]}\")" # 109| local x # 110|-> for x in ${@:2} ; do echo "${v[$x]}"; done # 111| } # 112| Error: SHELLCHECK_WARNING (CWE-457): /usr/share/doc/bash/examples/functions/arrayops.bash:110:32: warning[SC2154]: v is referenced but not assigned. # 108| eval local "v=(\"\${$1[@]}\")" # 109| local x # 110|-> for x in ${@:2} ; do echo "${v[$x]}"; done # 111| } # 112| Error: SHELLCHECK_WARNING (CWE-252): /usr/share/doc/bash/examples/functions/autoload.v4.t:7:1: warning[SC2164]: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. # 5| cp autoload $workdir # 6| # 7|-> cd $workdir # 8| pwd # 9| Error: SHELLCHECK_WARNING: /usr/share/doc/bash/examples/functions/autoload.v4.t:36:19: warning[SC2076]: Remove quotes from right-hand side of =~ to match as a regex rather than literally. # 34| testname="$funcname loaded" # 35| got=$(type $funcname 2>&1) # 36|-> if [[ $got =~ "$funcname: not found" ]]; then # 37| echo "## Failed $testname" # 38| ((failed+=1)) Error: SHELLCHECK_WARNING: /usr/share/doc/bash/examples/functions/autoload.v4.t:81:17: warning[SC2076]: Remove quotes from right-hand side of =~ to match as a regex rather than literally. # 79| autoload -u $funcname # 80| got=$(type $funcname 2>&1) # 81|-> if [[ ! $got =~ "$funcname: not found" ]]; then # 82| echo "## Failed $testname" # 83| ((failed+=1)) Error: SHELLCHECK_WARNING: /usr/share/doc/bash/examples/functions/autoload.v4.t:119:19: warning[SC2076]: Remove quotes from right-hand side of =~ to match as a regex rather than literally. # 117| for funcname in $funclist; do # 118| got=$(type $funcname 2>&1) # 119|-> if [[ $got =~ "$funcname: not found" ]]; then # 120| echo "## Failed $testname - $funcname" # 121| ((localfailed+=1)) Error: SHELLCHECK_WARNING: /usr/share/doc/bash/examples/functions/autoload.v4.t:144:21: warning[SC2076]: Remove quotes from right-hand side of =~ to match as a regex rather than literally. # 142| for funcname in $funclist; do # 143| got=$(type $funcname 2>&1) # 144|-> if [[ ! $got =~ "$funcname: not found" ]]; then # 145| echo "## Failed $testname - $funcname" # 146| ((localfailed+=1)) Error: SHELLCHECK_WARNING: /usr/share/doc/bash/examples/functions/autoload.v4.t:164:19: warning[SC2076]: Remove quotes from right-hand side of =~ to match as a regex rather than literally. # 162| for funcname in $funclist; do # 163| got=$(type $funcname 2>&1) # 164|-> if [[ $got =~ "$funcname: not found" ]]; then # 165| echo "## Failed $testname - $funcname" # 166| ((localfailed+=1)) Error: SHELLCHECK_WARNING (CWE-398): /usr/share/doc/bash/examples/functions/dirstack:52:7: warning[SC2100]: Use $((..)) for arithmetics, e.g. i=$((i - 2)) # 50| case "$dir" in # 51| - ) # cd - => equivalent to : cd -1 # 52|-> ind=INDTOP-1 # 53| cd_by_number $ind # 54| ;; Error: SHELLCHECK_WARNING (CWE-398): /usr/share/doc/bash/examples/functions/dirstack:77:6: warning[SC2100]: Use $((..)) for arithmetics, e.g. i=$((i + 2)) # 75| else # 76| dirtmp="${tab[k]}" # 77|-> j=k+1 # 78| while (( j <= INDTOP )) # 79| do Error: SHELLCHECK_WARNING (CWE-398): /usr/share/doc/bash/examples/functions/dirstack:81:9: warning[SC2100]: Use $((..)) for arithmetics, e.g. i=$((i + 2)) # 79| do # 80| tab[j-1]="${tab[j]}" # 81|-> j=j+1 # 82| done # 83| tab[INDTOP]="$dirtmp" Error: SHELLCHECK_WARNING (CWE-252): /usr/share/doc/bash/examples/functions/dirstack:84:5: warning[SC2164]: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. # 82| done # 83| tab[INDTOP]="$dirtmp" # 84|-> \cd "${tab[INDTOP]}" # 85| fi # 86| } Error: SHELLCHECK_WARNING (CWE-398): /usr/share/doc/bash/examples/functions/dirstack:107:7: warning[SC2100]: Use $((..)) for arithmetics, e.g. i=$((i - 2)) # 105| then break # 106| fi # 107|-> i=i-1 # 108| done # 109| Error: SHELLCHECK_WARNING (CWE-398): /usr/share/doc/bash/examples/functions/dirstack:124:9: warning[SC2100]: Use $((..)) for arithmetics, e.g. i=$((i + 2)) # 122| do # 123| tab[m-1]="${tab[m]}" # 124|-> m=m+1 # 125| done # 126| else # the new directory is added to the top of the stack Error: SHELLCHECK_WARNING (CWE-398): /usr/share/doc/bash/examples/functions/dirstack:127:11: warning[SC2100]: Use $((..)) for arithmetics, e.g. i=$((i + 2)) # 125| done # 126| else # the new directory is added to the top of the stack # 127|-> INDTOP=INDTOP+1 # 128| fi # 129| tab[INDTOP]="$rep" Error: SHELLCHECK_WARNING (CWE-252): /usr/share/doc/bash/examples/functions/dirstack:130:8: warning[SC2164]: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. # 128| fi # 129| tab[INDTOP]="$rep" # 130|-> \cd "${tab[INDTOP]}" # 131| return 0 # 132| Error: SHELLCHECK_WARNING (CWE-691): /usr/share/doc/bash/examples/functions/dirstack:150:5: warning[SC2254]: Quote expansions in case patterns to match literally rather than as a glob. # 148| rep="${tab[INDTOP-i]#$HOME/}" # 149| case "$rep" in # 150|-> $HOME) rep="~" ;; # 151| /* ) : ;; # 152| * ) rep="~/$rep" Error: SHELLCHECK_WARNING (CWE-398): /usr/share/doc/bash/examples/functions/dirstack:152:18: warning[SC2088]: Tilde does not expand in quotes. Use $HOME. # 150| $HOME) rep="~" ;; # 151| /* ) : ;; # 152|-> * ) rep="~/$rep" # 153| esac # 154| Error: SHELLCHECK_WARNING (CWE-398): /usr/share/doc/bash/examples/functions/dirstack:156:6: warning[SC2100]: Use $((..)) for arithmetics, e.g. i=$((i + 2)) # 154| # 155| echo "$i ) $rep" # 156|-> i=i+1 # 157| done # 158| } Error: SHELLCHECK_WARNING (CWE-149): /usr/share/doc/bash/examples/misc/cshtobash:80:15: warning[SC2140]: Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"? # 78| sed -e '/^SHLVL/d' \ # 79| -e '/^PWD/d' \ # 80|-> -e "s/'/'"\\\\"''"/g \ # 81| -e "s/^\([A-Za-z0-9_]*=\)/export \1'/" \ # 82| -e "s/$/'/" < $TMPFILEe Error: SHELLCHECK_WARNING (CWE-149): /usr/share/doc/bash/examples/misc/cshtobash:90:15: warning[SC2140]: Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"? # 88| # 89| sed -e 's/'"$T"'/=/' \ # 90|-> -e "s/'/'"\\\\"''"/g \ # 91| -e '/^[A-Za-z0-9_]*=[^(]/{ # 92| s/=/='"'/"' Error: SHELLCHECK_WARNING (CWE-758): /usr/share/doc/bash/examples/scripts/cat.sh:1:1: error[SC2148]: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. # 1|-> shcat() # 2| { # 3| while read -r ; do Error: SHELLCHECK_WARNING (CWE-156): /usr/share/doc/bash/examples/scripts/inpath:9:5: warning[SC2046]: Quote this to prevent word splitting. # 7| [ -n "$command" ] || exit 1 # 8| # 9|-> set `echo $PATH | sed 's/^:/.:/ # 10| s/::/:.:/g # 11| s/:$/:./ Error: SHELLCHECK_WARNING (CWE-456): /usr/share/doc/bash/examples/scripts/shprompt:32:1: warning[SC2209]: Use var=$(command) to assign output (or quote to assign string). # 30| # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # 31| # 32|-> type=file # 33| # 34| OPTS=dDfFsy Error: SHELLCHECK_WARNING (CWE-456): /usr/share/doc/bash/examples/scripts/shprompt:47:5: warning[SC2209]: Use var=$(command) to assign output (or quote to assign string). # 45| s) type=string # 46| ;; # 47|-> f) type=file # 48| ;; # 49| F) type=path Error: SHELLCHECK_WARNING (CWE-457): /usr/share/doc/bash/examples/scripts/shprompt:85:9: warning[SC2154]: fn is referenced but not assigned. # 83| # # 84| eval fn="$ans" # 85|-> case "$fn" in # 86| /*) if test -e "$fn" ; then # 87| succeed "$fn" Error: SHELLCHECK_WARNING (CWE-457): /usr/share/doc/bash/examples/shellmath/assert.sh:28:17: warning[SC2154]: __shellmath_returnCodes is referenced but not assigned. # 26| echo " By default, asserts against the string output by the function." # 27| echo " Use -c to assert against the numeric return code instead." # 28|-> return "${__shellmath_returnCodes[FAIL]}" # 29| fi # 30| Error: SHELLCHECK_WARNING (CWE-457): /usr/share/doc/bash/examples/shellmath/assert.sh:46:29: warning[SC2154]: __shellmath_true is referenced but not assigned. # 44| # Exercise the function in optimized mode; it will run faster by avoiding # 45| # subshelling. This also suppresses dumping of function output to stdout. # 46|-> __shellmath_isOptimized=${__shellmath_true} # 47| "$func" "${args[@]}" # 48| returnCode=$? Error: SHELLCHECK_WARNING (CWE-457): /usr/share/doc/bash/examples/shellmath/assert.sh:49:29: warning[SC2154]: __shellmath_false is referenced but not assigned. # 47| "$func" "${args[@]}" # 48| returnCode=$? # 49|-> __shellmath_isOptimized=${__shellmath_false} # 50| # 51| # Fetch the return value(s) Error: SHELLCHECK_WARNING (CWE-457): /usr/share/doc/bash/examples/shellmath/assert.sh:69:21: warning[SC2154]: __shellmath_SUCCESS is referenced but not assigned. # 67| if [[ "${actualReturn[*]}" == "$expectedReturn" ]]; then # 68| _shellmath_setReturnValue "${GREEN}ok${NO_COLOR} " # 69|-> return "$__shellmath_SUCCESS" # 70| else # 71| _shellmath_setReturnValue "${RED}FAIL${NO_COLOR} (${actualReturn[*]}) " Error: SHELLCHECK_WARNING (CWE-457): /usr/share/doc/bash/examples/shellmath/assert.sh:72:21: warning[SC2154]: __shellmath_FAIL is referenced but not assigned. # 70| else # 71| _shellmath_setReturnValue "${RED}FAIL${NO_COLOR} (${actualReturn[*]}) " # 72|-> return "$__shellmath_FAIL" # 73| fi # 74| elif [[ $mode == RETURN_CODE ]]; then Error: SHELLCHECK_WARNING (CWE-457): /usr/share/doc/bash/examples/shellmath/faster_e_demo.sh:22:15: warning[SC2154]: __shellmath_true is referenced but not assigned. # 20| # Setting the '-t' flag will cause the script to time the algorithm # 21| if [[ "$1" == '-t' ]]; then # 22|-> do_timing=${__shellmath_true} # 23| shift # 24| fi Error: SHELLCHECK_WARNING (CWE-457): /usr/share/doc/bash/examples/shellmath/faster_e_demo.sh:48:7: warning[SC2154]: term is referenced but not assigned. # 46| _shellmath_divide 1 $zero_factorial # 47| _shellmath_getReturnValue term # 48|-> e=$term # 49| # 50| # Compute successive terms T(n) := T(n-1)/n and accumulate into e Error: SHELLCHECK_WARNING (CWE-140): /usr/share/doc/bash/examples/shellmath/runTests.sh:42:16: warning[SC2206]: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a. # 40| __shellfloat_commandBuffer="" # 41| # 42|-> words=($command) # 43| # 44| # Expand first word to an assertion function Error: SHELLCHECK_WARNING (CWE-149): /usr/share/doc/bash/examples/shellmath/runTests.sh:91:68: warning[SC2027]: The surrounding quotes actually unquote this. Remove or escape them. # 89| words[nextWord]=_shellmath_${words[nextWord]} # 90| if ! type -t "${words[nextWord]}" >/dev/null; then # 91|-> echo "${RED}FAIL${NO_COLOR} Line $lineNumber: Command "$command": Syntax error. Required: String|Code value operation args..." # 92| return 3 # 93| fi Error: SHELLCHECK_WARNING (CWE-457): /usr/share/doc/bash/examples/shellmath/runTests.sh:115:48: warning[SC2154]: __shellmath_true is referenced but not assigned. # 113| # functions need to do this themselves, but there are some "private" # 114| # functions that need this here when they are auto-tested. # 115|-> _shellmath_precalc; __shellmath_didPrecalc=$__shellmath_true # 116| # 117| # Process the test file line-by-line using the above runTests() function Error: SHELLCHECK_WARNING (CWE-457): /usr/share/doc/bash/examples/shellmath/slower_e_demo.sh:13:15: warning[SC2154]: __shellmath_true is referenced but not assigned. # 11| # Setting the '-t' flag will cause the script to time the algorithm # 12| if [[ "$1" == '-t' ]]; then # 13|-> do_timing=${__shellmath_true} # 14| shift # 15| fi Error: CPPCHECK_WARNING: bash-5.2/alias.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/alias.c:361:3: warning[deadcode.DeadStores]: Value stored to 'i' is never read # 359| /* skip quoted strings, in ' or ", and words in which a character is quoted # 360| with a `\'. */ # 361|-> i = backslash_quoted_word = pass_next = 0; # 362| # 363| /* Skip leading whitespace (or separator characters), and quoted words. Error: CPPCHECK_WARNING: bash-5.2/array.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/array.c:66:14: warning[-Wunused-variable]: ‘spacesep’ defined but not used # 66 | static char *spacesep = " "; # | ^~~~~~~~ # 64| static char *array_to_string_internal PARAMS((ARRAY_ELEMENT *, ARRAY_ELEMENT *, char *, int)); # 65| # 66|-> static char *spacesep = " "; # 67| # 68| #define IS_LASTREF(a) (a->lastref) Error: CLANG_WARNING: bash-5.2/array.c:593:3: warning[deadcode.DeadStores]: Value stored to 'startind' is never read # 591| if (i < startind/2) { # 592| start = element_forw(a->head); # 593|-> startind = element_index(start); # 594| direction = 1; # 595| } else if (i >= startind) { Error: CLANG_WARNING: bash-5.2/array.c:658:3: warning[deadcode.DeadStores]: Value stored to 'startind' is never read # 656| if (i < startind/2) { # 657| start = element_forw(a->head); # 658|-> startind = element_index(start); # 659| direction = 1; # 660| } else if (i >= startind) { Error: CLANG_WARNING: bash-5.2/array.c:713:3: warning[deadcode.DeadStores]: Value stored to 'startind' is never read # 711| if (i < startind/2) { /* XXX - guess */ # 712| start = element_forw(a->head); # 713|-> startind = element_index(start); # 714| direction = 1; # 715| } else if (i >= startind) { Error: CPPCHECK_WARNING (CWE-457): bash-5.2/array.c:870: error[uninitvar]: Uninitialized variable: t # 868| { # 869| for (i = 0; i < count; i++) # 870|-> array_insert (a, i, t); # 871| return a; # 872| } Error: CLANG_WARNING: bash-5.2/array.c:870:2: warning[core.CallAndMessage]: 3rd function call argument is an uninitialized value # 868| { # 869| for (i = 0; i < count; i++) # 870|-> array_insert (a, i, t); # 871| return a; # 872| } Error: GCC_ANALYZER_WARNING (CWE-457): bash-5.2/array.c: scope_hint: In function ‘array_from_argv’ bash-5.2/array.c:870:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘t’ # 868| { # 869| for (i = 0; i < count; i++) # 870|-> array_insert (a, i, t); # 871| return a; # 872| } Error: COMPILER_WARNING (CWE-457): bash-5.2/array.c: scope_hint: In function ‘array_from_argv’ bash-5.2/array.c:870:9: warning[-Wmaybe-uninitialized]: ‘t’ may be used uninitialized # 870 | array_insert (a, i, t); # | ^~~~~~~~~~~~~~~~~~~~~~ bash-5.2/array.c:865:10: note: ‘t’ was declared here # 865 | char *t; # | ^ # 868| { # 869| for (i = 0; i < count; i++) # 870|-> array_insert (a, i, t); # 871| return a; # 872| } Error: CPPCHECK_WARNING: bash-5.2/arrayfunc.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/arrayfunc.c: scope_hint: In function ‘assign_array_element_internal’ bash-5.2/arrayfunc.c:407:9: warning[-Wunused-variable]: unused variable ‘newval’ # 407 | char *newval; # | ^~~~~~ # 405| char *akey, *nkey; # 406| arrayind_t ind; # 407|-> char *newval; # 408| # 409| /* rely on the caller to initialize estatep */ Error: COMPILER_WARNING (CWE-457): bash-5.2/arrayfunc.c:432:36: warning[-Wmaybe-uninitialized]: ‘nkey’ may be used uninitialized # 432 | estatep->value = entry ? assoc_reference (assoc_cell (entry), nkey) : 0; # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bash-5.2/arrayfunc.c: scope_hint: In function ‘assign_array_element’ bash-5.2/arrayfunc.c:405:16: note: ‘nkey’ was declared here # 405 | char *akey, *nkey; # | ^~~~ # 430| estatep->type = ARRAY_ASSOC; # 431| estatep->key = nkey; # 432|-> estatep->value = entry ? assoc_reference (assoc_cell (entry), nkey) : 0; # 433| } # 434| } Error: CLANG_WARNING: bash-5.2/arrayfunc.c:796:9: warning[core.NullDereference]: Access to field 'max_index' results in a dereference of a null pointer (loaded from field 'value') # 794| /* negative subscripts to indexed arrays count back from end */ # 795| if (ind < 0) # 796|-> ind = array_max_index (array_cell (var)) + 1 + ind; # 797| if (ind < 0) # 798| { Error: COMPILER_WARNING (CWE-563): bash-5.2/arrayfunc.c: scope_hint: In function ‘array_value_internal’ bash-5.2/arrayfunc.c:1483:21: warning[-Wunused-but-set-variable]: variable ‘subtype’ set but not used # 1483 | int len, isassoc, subtype; # | ^~~~~~~ # 1481| array_eltstate_t *estatep; # 1482| { # 1483|-> int len, isassoc, subtype; # 1484| arrayind_t ind; # 1485| char *akey; Error: CLANG_WARNING: bash-5.2/arrayfunc.c:1505:3: warning[deadcode.DeadStores]: Value stored to 'subtype' is never read # 1503| /* [ */ # 1504| akey = 0; # 1505|-> subtype = 0; # 1506| if (estatep) # 1507| estatep->value = (char *)NULL; Error: GCC_ANALYZER_WARNING (CWE-457): bash-5.2/arrayfunc.c: scope_hint: In function ‘array_value_internal’ bash-5.2/arrayfunc.c:1615:48: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘ind’ bash-5.2/arrayfunc.c:1585:16: note: in expansion of macro ‘assoc_p’ bash-5.2/arrayfunc.c:1604:23: note: in expansion of macro ‘value_cell’ bash-5.2/arrayfunc.c:1609:16: note: in expansion of macro ‘invisible_p’ # 1613| } # 1614| if (array_p (var) == 0 && assoc_p (var) == 0) # 1615|-> retval = (ind == 0) ? value_cell (var) : (char *)NULL; # 1616| else if (assoc_p (var)) # 1617| { Error: COMPILER_WARNING (CWE-457): bash-5.2/arrayfunc.c: scope_hint: In function ‘array_value_internal’ bash-5.2/arrayfunc.c:1615:48: warning[-Wmaybe-uninitialized]: ‘ind’ may be used uninitialized # 1615 | retval = (ind == 0) ? value_cell (var) : (char *)NULL; # | ^ bash-5.2/arrayfunc.c:1484:14: note: ‘ind’ was declared here # 1484 | arrayind_t ind; # | ^~~ # 1613| } # 1614| if (array_p (var) == 0 && assoc_p (var) == 0) # 1615|-> retval = (ind == 0) ? value_cell (var) : (char *)NULL; # 1616| else if (assoc_p (var)) # 1617| { Error: GCC_ANALYZER_WARNING (CWE-457): bash-5.2/arrayfunc.c:1627:18: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘ind’ bash-5.2/arrayfunc.c:1585:16: note: in expansion of macro ‘assoc_p’ bash-5.2/arrayfunc.c:1604:23: note: in expansion of macro ‘value_cell’ bash-5.2/arrayfunc.c:1609:16: note: in expansion of macro ‘invisible_p’ bash-5.2/arrayfunc.c:1616:16: note: in expansion of macro ‘assoc_p’ # 1625| } # 1626| else # 1627|-> retval = array_reference (array_cell (var), ind); # 1628| # 1629| if (estatep) Error: COMPILER_WARNING (CWE-563): bash-5.2/arrayfunc.c: scope_hint: In function ‘array_keys’ bash-5.2/arrayfunc.c:1672:22: warning[-Wunused-variable]: unused variable ‘temp’ # 1672 | char *retval, *t, *temp; # | ^~~~ # 1670| { # 1671| int len; # 1672|-> char *retval, *t, *temp; # 1673| WORD_LIST *l; # 1674| SHELL_VAR *var; Error: CPPCHECK_WARNING: bash-5.2/assoc.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-457): bash-5.2/assoc.h:31:37: warning[-Wmaybe-uninitialized]: ‘h’ may be used uninitialized # 31 | #define assoc_num_elements(h) ((h)->nentries) # | ~~~~^~~~~~~~~~~ bash-5.2/subst.c: scope_hint: In function ‘parameter_brace_substring’ bash-5.2/subst.c:8124:14: note: ‘h’ was declared here # 8124 | HASH_TABLE *h; # | ^ # 29| # 30| #define assoc_empty(h) ((h)->nentries == 0) # 31|-> #define assoc_num_elements(h) ((h)->nentries) # 32| # 33| #define assoc_create(n) (hash_create((n))) Error: CPPCHECK_WARNING: bash-5.2/bashhist.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/bashhist.c:564:3: warning[deadcode.DeadStores]: Value stored to 'expanded' is never read # 562| # 563| return_value = line; # 564|-> expanded = 0; # 565| # 566| # if defined (BANG_HISTORY) Error: CLANG_WARNING: bash-5.2/bashhist.c:632:7: warning[deadcode.DeadStores]: Value stored to 'expanded' is never read # 630| and that a line has been added to the history list. Note # 631| that we only add lines that have something in them. */ # 632|-> expanded = 1; # 633| return_value = history_value; # 634| } Error: COMPILER_WARNING (CWE-569): bash-5.2/bashhist.c: scope_hint: In function ‘hc_erasedups’ bash-5.2/bashhist.c:731:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 731 | while (temp = previous_history ()) # | ^~~~ # 729| # 730| using_history (); # 731|-> while (temp = previous_history ()) # 732| { # 733| if (STREQ (temp->line, line)) Error: COMPILER_WARNING (CWE-704): bash-5.2/bashhist.c: scope_hint: In function ‘bash_syslog_history’ bash-5.2/bashhist.c:851:16: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 851 | for (msg = line, i = 0; i < chunks; i++) # | ^ # 849| { # 850| chunks = ((msglen + hdrlen) / SYSLOG_MAXLEN) + 1; # 851|-> for (msg = line, i = 0; i < chunks; i++) # 852| { # 853| seqnum = inttostr (i + 1, seqbuf, sizeof (seqbuf)); Error: CPPCHECK_WARNING: bash-5.2/bashline.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-1164): bash-5.2/bashline.c: scope_hint: At top level bash-5.2/bashline.c:214:12: warning[-Wunused-function]: ‘set_saved_history’ declared ‘static’ but never defined # 214 | static int set_saved_history PARAMS((void)); # | ^~~~~~~~~~~~~~~~~ # 212| static int isolate_sequence PARAMS((char *, int, int, int *)); # 213| # 214|-> static int set_saved_history PARAMS((void)); # 215| # 216| #if defined (ALIAS) Error: COMPILER_WARNING (CWE-569): bash-5.2/bashline.c: scope_hint: In function ‘snarf_hosts_from_file’ bash-5.2/bashline.c:811:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 811 | while (temp = fgets (buffer, 255, file)) # | ^~~~ # 809| return; # 810| # 811|-> while (temp = fgets (buffer, 255, file)) # 812| { # 813| /* Skip to first character. */ Error: GCC_ANALYZER_WARNING (CWE-835): bash-5.2/bashline.c: scope_hint: In function ‘snarf_hosts_from_file’ bash-5.2/bashline.c:842:22: warning[-Wanalyzer-infinite-loop]: infinite loop bash-5.2/bashline.c:842:29: note: in expansion of macro ‘cr_whitespace’ # 840| /* Skip internet address if present. */ # 841| if (DIGIT (buffer[i])) # 842|-> for (; buffer[i] && cr_whitespace (buffer[i]) == 0; i++); # 843| # 844| /* Gobble up names. Each name is separated with whitespace. */ Error: GCC_ANALYZER_WARNING (CWE-835): bash-5.2/bashline.c:853:33: warning[-Wanalyzer-infinite-loop]: infinite loop bash-5.2/bashline.c:853:40: note: in expansion of macro ‘cr_whitespace’ # 851| # 852| /* Isolate the current word. */ # 853|-> for (start = i; buffer[i] && cr_whitespace (buffer[i]) == 0; i++) # 854| ; # 855| if (i == start) Error: GCC_ANALYZER_WARNING (CWE-674): bash-5.2/bashline.c: scope_hint: In function ‘bash_backward_kill_shellword’ bash-5.2/bashline.c:1245:13: warning[-Wanalyzer-infinite-recursion]: infinite recursion # 1243| # 1244| if (count < 0) # 1245|-> return (bash_backward_kill_shellword (-count, key)); # 1246| # 1247| p = rl_point; Error: GCC_ANALYZER_WARNING (CWE-674): bash-5.2/bashline.c: scope_hint: In function ‘bash_kill_shellword’ bash-5.2/bashline.c:1267:13: warning[-Wanalyzer-infinite-recursion]: infinite recursion # 1265| # 1266| if (count < 0) # 1267|-> return (bash_kill_shellword (-count, key)); # 1268| # 1269| p = rl_point; Error: COMPILER_WARNING (CWE-563): bash-5.2/bashline.c: scope_hint: In function ‘bash_spell_correct_shellword’ bash-5.2/bashline.c:1346:7: warning[-Wunused-but-set-variable]: variable ‘opoint’ set but not used # 1346 | int opoint, wbeg, wend; # | ^~~~~~ # 1344| int count, key; # 1345| { # 1346|-> int opoint, wbeg, wend; # 1347| char *text, *newdir; # 1348| Error: CPPCHECK_WARNING (CWE-457): bash-5.2/bashline.c:1687: error[uninitvar]: Uninitialized variable: e1 # 1685| if (s > rl_end) # 1686| { # 1687|-> s1 = s = e1; # 1688| break; # 1689| } Error: COMPILER_WARNING (CWE-569): bash-5.2/bashline.c: scope_hint: In function ‘attempt_shell_completion’ bash-5.2/bashline.c:1704:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 1704 | while (was_assignment = assignment (n, 0)); # | ^~~~~~~~~~~~~~ # 1702| s = e1 + 1; # 1703| } # 1704|-> while (was_assignment = assignment (n, 0)); # 1705| s = s1; /* reset to index where name begins */ # 1706| Error: COMPILER_WARNING (CWE-457): bash-5.2/bashline.c: scope_hint: In function ‘attempt_shell_completion’ bash-5.2/bashline.c:1719:28: warning[-Wmaybe-uninitialized]: ‘e1’ may be used uninitialized # 1719 | else if (e == 0 && e == s && text[0] == '\0' && have_progcomps) /* beginning of empty line */ # | ~~^~~~ bash-5.2/bashline.c:1669:21: note: ‘e1’ was declared here # 1669 | int s, e, s1, e1, os, foundcs; # | ^~ # 1717| else if (start == end && start == s1 && e != 0 && e1 > end) /* beginning of command name, leading whitespace */ # 1718| foundcs = 0; # 1719|-> else if (e == 0 && e == s && text[0] == '\0' && have_progcomps) /* beginning of empty line */ # 1720| prog_complete_matches = programmable_completions (EMPTYCMD, text, s, e, &foundcs); # 1721| else if (start == end && text[0] == '\0' && s1 > start && whitespace (rl_line_buffer[start])) Error: COMPILER_WARNING (CWE-569): bash-5.2/bashline.c: scope_hint: In function ‘command_word_completion_function’ bash-5.2/bashline.c:2209:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 2209 | while (val = glob_matches[local_index++]) # | ^~~ # 2207| } # 2208| # 2209|-> while (val = glob_matches[local_index++]) # 2210| { # 2211| if (executable_or_directory (val)) Error: COMPILER_WARNING (CWE-569): bash-5.2/bashline.c: scope_hint: In function ‘bash_servicename_completion_function’ bash-5.2/bashline.c:2609:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 2609 | while (srvent = getservent ()) # | ^~~~~~ # 2607| } # 2608| # 2609|-> while (srvent = getservent ()) # 2610| { # 2611| afound = 0; Error: COMPILER_WARNING (CWE-569): bash-5.2/bashline.c: scope_hint: In function ‘bash_groupname_completion_function’ bash-5.2/bashline.c:2665:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 2665 | while (grent = getgrent ()) # | ^~~~~ # 2663| } # 2664| # 2665|-> while (grent = getgrent ()) # 2666| { # 2667| if (gnamelen == 0 || (STREQN (gname, grent->gr_name, gnamelen))) Error: COMPILER_WARNING (CWE-563): bash-5.2/bashline.c: scope_hint: In function ‘history_and_alias_expand_line’ bash-5.2/bashline.c:2847:20: warning[-Wunused-variable]: unused variable ‘t’ # 2847 | char *new_line, *t; # | ^ # 2845| int count, ignore; # 2846| { # 2847|-> char *new_line, *t; # 2848| # 2849| new_line = 0; Error: GCC_ANALYZER_WARNING (CWE-457): bash-5.2/bashline.c: scope_hint: In function ‘_ignore_completion_names’ bash-5.2/bashline.c:3027:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘oldnames’ # 3025| newnames[nidx++] = names[idx]; # 3026| else if (force_fignore == 0) # 3027|-> oldnames[oidx++] = names[idx]; # 3028| else # 3029| free (names[idx]); Error: COMPILER_WARNING (CWE-457): bash-5.2/bashline.c: scope_hint: In function ‘_ignore_completion_names’ bash-5.2/bashline.c:3027:17: warning[-Wmaybe-uninitialized]: ‘oldnames’ may be used uninitialized # 3027 | oldnames[oidx++] = names[idx]; # | ^ bash-5.2/bashline.c:2990:10: note: ‘oldnames’ was declared here # 2990 | char **oldnames; # | ^~~~~~~~ # 3025| newnames[nidx++] = names[idx]; # 3026| else if (force_fignore == 0) # 3027|-> oldnames[oidx++] = names[idx]; # 3028| else # 3029| free (names[idx]); Error: GCC_ANALYZER_WARNING (CWE-457): bash-5.2/bashline.c:3043:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘oldnames’ # 3041| } # 3042| else # 3043|-> free (oldnames); # 3044| # 3045| free (newnames); Error: GCC_ANALYZER_WARNING (CWE-457): bash-5.2/bashline.c:3053:7: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘oldnames’ # 3051| while (oidx) # 3052| free (oldnames[--oidx]); # 3053|-> free (oldnames); # 3054| } # 3055| Error: COMPILER_WARNING (CWE-569): bash-5.2/bashline.c: scope_hint: In function ‘bash_filename_stat_hook’ bash-5.2/bashline.c:3385:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 3385 | if (t = mbschr (local_dirname, '$')) # | ^ # 3383| local_dirname = *dirname; # 3384| should_expand_dirname = return_value = 0; # 3385|-> if (t = mbschr (local_dirname, '$')) # 3386| should_expand_dirname = '$'; # 3387| else if (t = mbschr (local_dirname, '`')) /* XXX */ Error: COMPILER_WARNING (CWE-569): bash-5.2/bashline.c:3387:12: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 3387 | else if (t = mbschr (local_dirname, '`')) /* XXX */ # | ^ # 3385| if (t = mbschr (local_dirname, '$')) # 3386| should_expand_dirname = '$'; # 3387|-> else if (t = mbschr (local_dirname, '`')) /* XXX */ # 3388| should_expand_dirname = '`'; # 3389| Error: COMPILER_WARNING (CWE-563): bash-5.2/bashline.c: scope_hint: In function ‘bash_directory_completion_hook’ bash-5.2/bashline.c:3540:18: warning[-Wunused-variable]: unused variable ‘l1’ # 3540 | size_t l1, l2; # | ^~ # 3538| if (temp2 == 0 && dircomplete_spelling && dircomplete_expand) # 3539| { # 3540|-> size_t l1, l2; # 3541| # 3542| temp2 = dirspell (temp1); Error: COMPILER_WARNING (CWE-569): bash-5.2/bashline.c: scope_hint: In function ‘bash_check_expchar’ bash-5.2/bashline.c:4172:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 4172 | if (t = mbschr (dirname, '$')) # | ^ # 4170| # 4171| ret = n = c = 0; # 4172|-> if (t = mbschr (dirname, '$')) # 4173| { # 4174| ret = '$'; Error: COMPILER_WARNING (CWE-569): bash-5.2/bashline.c: scope_hint: In function ‘set_filename_quote_chars’ bash-5.2/bashline.c:4231:23: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 4231 | for (i = j = 0; c = default_filename_quote_characters[i]; i++) # | ^ # 4229| i = strlen (default_filename_quote_characters); # 4230| custom_filename_quote_characters = xrealloc (custom_filename_quote_characters, i+1); # 4231|-> for (i = j = 0; c = default_filename_quote_characters[i]; i++) # 4232| { # 4233| if (c == expchar || c == nextch || c == closer) Error: COMPILER_WARNING (CWE-1164): bash-5.2/bashline.c:4386:1: warning[-Wunused-function]: ‘putx’ defined but not used # 4386 | putx(c) # | ^~~~ # 4384| static int # 4385| #endif # 4386|-> putx(c) # 4387| int c; # 4388| { Error: COMPILER_WARNING (CWE-563): bash-5.2/bashline.c: scope_hint: In function ‘bash_execute_unix_command’ bash-5.2/bashline.c:4447:27: warning[-Wunused-variable]: unused variable ‘old_ch’ # 4447 | char *cmd, *value, *ce, old_ch; # | ^~~~~~ # 4445| intmax_t mi; # 4446| sh_parser_state_t ps; # 4447|-> char *cmd, *value, *ce, old_ch; # 4448| SHELL_VAR *v; # 4449| char ibuf[INT_STRLEN_BOUND(int) + 1]; Error: COMPILER_WARNING (CWE-1164): bash-5.2/bashline.c:4584:1: warning[-Wunused-function]: ‘get_cmd_xmap_from_edit_mode’ defined but not used # 4584 | get_cmd_xmap_from_edit_mode () # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ # 4582| # 4583| static Keymap # 4584|-> get_cmd_xmap_from_edit_mode () # 4585| { # 4586| if (emacs_std_cmd_xmap == 0) Error: COMPILER_WARNING (CWE-569): bash-5.2/bashline.c: scope_hint: In function ‘isolate_sequence’ bash-5.2/bashline.c:4649:19: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 4649 | for (passc = 0; c = string[i]; i++) # | ^ # 4647| *startp = delim ? ++i : i; # 4648| # 4649|-> for (passc = 0; c = string[i]; i++) # 4650| { # 4651| if (passc) Error: CPPCHECK_WARNING: bash-5.2/bracecomp.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/braces.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/braces.c:132:4: warning[deadcode.DeadStores]: Value stored to 'start' is never read # 130| if (c) # 131| { # 132|-> start = j = i + 1; /* { */ # 133| c = brace_gobbler (text, tlen, &j, '}'); # 134| if (c == 0) /* it's not */ Error: COMPILER_WARNING (CWE-457): bash-5.2/braces.c:371:13: warning[-Wmaybe-uninitialized]: ‘tr’ may be used uninitialized # 371 | if (start > end && incr > 0) # | ~~~~~~^~~~~ bash-5.2/braces.c: scope_hint: In function ‘brace_expand’ bash-5.2/braces.c:479:16: note: ‘tr’ was declared here # 479 | intmax_t tl, tr; # | ^~ # 369| incr = 1; # 370| # 371|-> if (start > end && incr > 0) # 372| incr = -incr; # 373| else if (start < end && incr < 0) Error: CLANG_WARNING: bash-5.2/braces.c:388:29: note: Left side of '&&' is false # 386| prevn = sh_imaxabs (end - start); # 387| /* Need to check this way in case INT_MAX == INTMAX_MAX */ # 388|-> if (INT_MAX == INTMAX_MAX && (ADDOVERFLOW (prevn, 2, INT_MIN, INT_MAX))) # 389| return ((char **)NULL); # 390| /* Make sure the assignment to nelem below doesn't end up <= 0 due to Error: CLANG_WARNING: bash-5.2/braces.c:392:12: note: Left side of '&&' is false # 390| /* Make sure the assignment to nelem below doesn't end up <= 0 due to # 391| intmax_t overflow */ # 392|-> else if (ADDOVERFLOW ((prevn/sh_imaxabs(incr)), 1, INTMAX_MIN, INTMAX_MAX)) # 393| return ((char **)NULL); # 394| Error: CLANG_WARNING: bash-5.2/braces.c:392:32: note: '?' condition is true # 390| /* Make sure the assignment to nelem below doesn't end up <= 0 due to # 391| intmax_t overflow */ # 392|-> else if (ADDOVERFLOW ((prevn/sh_imaxabs(incr)), 1, INTMAX_MIN, INTMAX_MAX)) # 393| return ((char **)NULL); # 394| Error: CLANG_WARNING: bash-5.2/braces.c:392:32: note: 'incr' is >= 0 # 390| /* Make sure the assignment to nelem below doesn't end up <= 0 due to # 391| intmax_t overflow */ # 392|-> else if (ADDOVERFLOW ((prevn/sh_imaxabs(incr)), 1, INTMAX_MIN, INTMAX_MAX)) # 393| return ((char **)NULL); # 394| Error: CLANG_WARNING: bash-5.2/braces.c:392:32: note: Assuming 'incr' is >= 0 # 390| /* Make sure the assignment to nelem below doesn't end up <= 0 due to # 391| intmax_t overflow */ # 392|-> else if (ADDOVERFLOW ((prevn/sh_imaxabs(incr)), 1, INTMAX_MIN, INTMAX_MAX)) # 393| return ((char **)NULL); # 394| Error: CLANG_WARNING: bash-5.2/braces.c:400:3: note: Taking false branch # 398| nelem = (prevn / imaxabs(incr)) + 1; # 399| would work */ # 400|-> if ((prevn / sh_imaxabs (incr)) > INT_MAX - 3) /* check int overflow */ # 401| return ((char **)NULL); # 402| nelem = (prevn / sh_imaxabs(incr)) + 1; Error: CLANG_WARNING: bash-5.2/braces.c:400:16: note: '?' condition is true # 398| nelem = (prevn / imaxabs(incr)) + 1; # 399| would work */ # 400|-> if ((prevn / sh_imaxabs (incr)) > INT_MAX - 3) /* check int overflow */ # 401| return ((char **)NULL); # 402| nelem = (prevn / sh_imaxabs(incr)) + 1; Error: CLANG_WARNING: bash-5.2/braces.c:400:16: note: 'incr' is >= 0 # 398| nelem = (prevn / imaxabs(incr)) + 1; # 399| would work */ # 400|-> if ((prevn / sh_imaxabs (incr)) > INT_MAX - 3) /* check int overflow */ # 401| return ((char **)NULL); # 402| nelem = (prevn / sh_imaxabs(incr)) + 1; Error: CLANG_WARNING: bash-5.2/braces.c:402:20: note: '?' condition is true # 400| if ((prevn / sh_imaxabs (incr)) > INT_MAX - 3) /* check int overflow */ # 401| return ((char **)NULL); # 402|-> nelem = (prevn / sh_imaxabs(incr)) + 1; # 403| result = strvec_mcreate (nelem + 1); # 404| if (result == 0) Error: CLANG_WARNING: bash-5.2/braces.c:402:20: note: 'incr' is >= 0 # 400| if ((prevn / sh_imaxabs (incr)) > INT_MAX - 3) /* check int overflow */ # 401| return ((char **)NULL); # 402|-> nelem = (prevn / sh_imaxabs(incr)) + 1; # 403| result = strvec_mcreate (nelem + 1); # 404| if (result == 0) Error: CLANG_WARNING: bash-5.2/braces.c:404:3: note: Taking false branch # 402| nelem = (prevn / sh_imaxabs(incr)) + 1; # 403| result = strvec_mcreate (nelem + 1); # 404|-> if (result == 0) # 405| { # 406| internal_error (_("brace expansion: failed to allocate memory for %u elements"), (unsigned int)nelem); Error: CLANG_WARNING: bash-5.2/braces.c:404:7: note: Assuming 'result' is not equal to null # 402| nelem = (prevn / sh_imaxabs(incr)) + 1; # 403| result = strvec_mcreate (nelem + 1); # 404|-> if (result == 0) # 405| { # 406| internal_error (_("brace expansion: failed to allocate memory for %u elements"), (unsigned int)nelem); Error: CLANG_WARNING: bash-5.2/braces.c:416:7: note: Taking true branch # 414| { # 415| #if defined (SHELL) # 416|-> if (ISINTERRUPT) # 417| { # 418| result[i] = (char *)NULL; Error: CLANG_WARNING: bash-5.2/braces.c:416:11: note: Assuming 'interrupt_state' is not equal to 0 # 414| { # 415| #if defined (SHELL) # 416|-> if (ISINTERRUPT) # 417| { # 418| result[i] = (char *)NULL; Error: CLANG_WARNING: bash-5.2/braces.c:420:11: note: Null pointer value stored to 'result' # 418| result[i] = (char *)NULL; # 419| strvec_dispose (result); # 420|-> result = (char **)NULL; # 421| } # 422| QUIT; Error: CLANG_WARNING: bash-5.2/braces.c:422:7: note: Assuming 'interrupt_state' is 0 # 420| result = (char **)NULL; # 421| } # 422|-> QUIT; # 423| #endif # 424| if (type == ST_INT) Error: CLANG_WARNING: bash-5.2/braces.c:422:7: note: Assuming 'terminating_signal' is 0 # 420| result = (char **)NULL; # 421| } # 422|-> QUIT; # 423| #endif # 424| if (type == ST_INT) Error: CLANG_WARNING: bash-5.2/braces.c:422:7: note: Loop condition is false. Exiting loop # 420| result = (char **)NULL; # 421| } # 422|-> QUIT; # 423| #endif # 424| if (type == ST_INT) Error: CLANG_WARNING: bash-5.2/braces.c:422:7: note: Taking false branch # 420| result = (char **)NULL; # 421| } # 422|-> QUIT; # 423| #endif # 424| if (type == ST_INT) Error: CLANG_WARNING: bash-5.2/braces.c:424:7: note: Taking false branch # 422| QUIT; # 423| #endif # 424|-> if (type == ST_INT) # 425| result[i++] = t = itos (n); # 426| else if (type == ST_ZINT) Error: CLANG_WARNING: bash-5.2/braces.c:424:7: note: Taking true branch # 422| QUIT; # 423| #endif # 424|-> if (type == ST_INT) # 425| result[i++] = t = itos (n); # 426| else if (type == ST_ZINT) Error: CLANG_WARNING: bash-5.2/braces.c:424:11: note: Assuming 'type' is equal to ST_INT # 422| QUIT; # 423| #endif # 424|-> if (type == ST_INT) # 425| result[i++] = t = itos (n); # 426| else if (type == ST_ZINT) Error: CLANG_WARNING: bash-5.2/braces.c:424:11: note: Assuming 'type' is not equal to ST_INT # 422| QUIT; # 423| #endif # 424|-> if (type == ST_INT) # 425| result[i++] = t = itos (n); # 426| else if (type == ST_ZINT) Error: CLANG_WARNING: bash-5.2/braces.c:425:14: note: Array access (from variable 'result') results in a null pointer dereference # 423| #endif # 424| if (type == ST_INT) # 425|-> result[i++] = t = itos (n); # 426| else if (type == ST_ZINT) # 427| { Error: CLANG_WARNING: bash-5.2/braces.c:425:14: warning[core.NullDereference]: Array access (from variable 'result') results in a null pointer dereference # 423| #endif # 424| if (type == ST_INT) # 425|-> result[i++] = t = itos (n); # 426| else if (type == ST_ZINT) # 427| { Error: GCC_ANALYZER_WARNING (CWE-476): bash-5.2/braces.c: scope_hint: In function ‘mkseq’ bash-5.2/braces.c:425:21: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘result’ # 423| #endif # 424| if (type == ST_INT) # 425|-> result[i++] = t = itos (n); # 426| else if (type == ST_ZINT) # 427| { Error: CLANG_WARNING: bash-5.2/braces.c:426:12: note: Taking false branch # 424| if (type == ST_INT) # 425| result[i++] = t = itos (n); # 426|-> else if (type == ST_ZINT) # 427| { # 428| int len, arg; Error: CLANG_WARNING: bash-5.2/braces.c:426:12: note: Taking true branch # 424| if (type == ST_INT) # 425| result[i++] = t = itos (n); # 426|-> else if (type == ST_ZINT) # 427| { # 428| int len, arg; Error: CLANG_WARNING: bash-5.2/braces.c:426:16: note: Assuming 'type' is equal to ST_ZINT # 424| if (type == ST_INT) # 425| result[i++] = t = itos (n); # 426|-> else if (type == ST_ZINT) # 427| { # 428| int len, arg; Error: CLANG_WARNING: bash-5.2/braces.c:426:16: note: Assuming 'type' is not equal to ST_ZINT # 424| if (type == ST_INT) # 425| result[i++] = t = itos (n); # 426|-> else if (type == ST_ZINT) # 427| { # 428| int len, arg; Error: COMPILER_WARNING (CWE-563): bash-5.2/braces.c: scope_hint: In function ‘mkseq’ bash-5.2/braces.c:428:15: warning[-Wunused-but-set-variable]: variable ‘len’ set but not used # 428 | int len, arg; # | ^~~ # 426| else if (type == ST_ZINT) # 427| { # 428|-> int len, arg; # 429| arg = n; # 430| len = asprintf (&t, "%0*d", width, arg); Error: CLANG_WARNING: bash-5.2/braces.c:430:4: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 428| int len, arg; # 429| arg = n; # 430|-> len = asprintf (&t, "%0*d", width, arg); # 431| result[i++] = t; # 432| } Error: CLANG_WARNING: bash-5.2/braces.c:431:16: note: Array access (from variable 'result') results in a null pointer dereference # 429| arg = n; # 430| len = asprintf (&t, "%0*d", width, arg); # 431|-> result[i++] = t; # 432| } # 433| else Error: CLANG_WARNING: bash-5.2/braces.c:431:16: warning[core.NullDereference]: Array access (from variable 'result') results in a null pointer dereference # 429| arg = n; # 430| len = asprintf (&t, "%0*d", width, arg); # 431|-> result[i++] = t; # 432| } # 433| else Error: CLANG_WARNING: bash-5.2/braces.c:435:4: note: Taking false branch # 433| else # 434| { # 435|-> if (t = (char *)malloc (2)) # 436| { # 437| t[0] = n; Error: CLANG_WARNING: bash-5.2/braces.c:435:8: note: Assuming 't' is null # 433| else # 434| { # 435|-> if (t = (char *)malloc (2)) # 436| { # 437| t[0] = n; Error: COMPILER_WARNING (CWE-569): bash-5.2/braces.c:435:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 435 | if (t = (char *)malloc (2)) # | ^ # 433| else # 434| { # 435|-> if (t = (char *)malloc (2)) # 436| { # 437| t[0] = n; Error: CLANG_WARNING: bash-5.2/braces.c:440:16: note: Array access (from variable 'result') results in a null pointer dereference # 438| t[1] = '\0'; # 439| } # 440|-> result[i++] = t; # 441| } # 442| Error: CLANG_WARNING: bash-5.2/braces.c:440:16: warning[core.NullDereference]: Array access (from variable 'result') results in a null pointer dereference # 438| t[1] = '\0'; # 439| } # 440|-> result[i++] = t; # 441| } # 442| Error: CLANG_WARNING: bash-5.2/braces.c:531:11: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'ep') # 529| if (ep && *ep == '.' && ep[1] == '.' && ep[2]) # 530| incr = strtoimax (ep + 2, &ep, 10); # 531|-> if (*ep != 0 || errno == ERANGE) # 532| rhs_t = ST_BAD; /* invalid incr or overflow */ # 533| tlen -= ep - oep; Error: COMPILER_WARNING (CWE-569): bash-5.2/braces.c: scope_hint: In function ‘brace_gobbler’ bash-5.2/braces.c:615:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 615 | while (c = text[i]) # | ^ # 613| # 614| i = *indx; # 615|-> while (c = text[i]) # 616| { # 617| if (pass_next) Error: CPPCHECK_WARNING: bash-5.2/builtins/bashgetopt.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/builtins/bind.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/builtins/caller.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/builtins/cd.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/builtins/cd.def:166:45: warning[core.NullDereference]: Access to field 'attributes' results in a dereference of a null pointer (loaded from variable 'tvar') # 164| r = EXECUTION_FAILURE; # 165| # 166|-> if (old_anm == 0 && array_needs_making && exported_p (tvar)) # 167| { # 168| update_export_env_inplace ("OLDPWD=", 7, pwdvar); Error: COMPILER_WARNING (CWE-1164): bash-5.2/builtins/cd.def: scope_hint: At top level bash-5.2/builtins/cd.def:198:1: warning[-Wunused-function]: ‘cdxattr’ defined but not used # 198 | cdxattr (dir, ndirp) # | ^~~~~~~ # 196| # 197| static int # 198|-> cdxattr (dir, ndirp) # 199| char *dir; /* don't assume we can always free DIR */ # 200| char **ndirp; /* return new constructed directory name */ Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/cd.def: scope_hint: In function ‘cd_builtin’ bash-5.2/builtins/cd.def:370:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 370 | while (path = extract_colon_unit (cdpath, &path_index)) # | ^~~~ # 368| /* Find directory in $CDPATH. */ # 369| path_index = 0; # 370|-> while (path = extract_colon_unit (cdpath, &path_index)) # 371| { # 372| /* OPT is 1 if the path element is non-empty */ Error: CLANG_WARNING: bash-5.2/builtins/cd.def:510:3: warning[deadcode.DeadStores]: Value stored to 'list' is never read # 508| } # 509| } # 510|-> list = loptend; # 511| # 512| #define tcwd the_current_working_directory Error: COMPILER_WARNING (CWE-563): bash-5.2/builtins/cd.def: scope_hint: In function ‘change_to_directory’ bash-5.2/builtins/cd.def:555:20: warning[-Wunused-variable]: unused variable ‘ndir’ # 555 | char *t, *tdir, *ndir; # | ^~~~ # 553| int nolinks, xattr; # 554| { # 555|-> char *t, *tdir, *ndir; # 556| int err, canon_failed, r, ndlen; # 557| Error: CPPCHECK_WARNING: bash-5.2/builtins/common.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/builtins/common.c:533:13: warning[core.NullDereference]: Access to field 'word' results in a dereference of a null pointer (loaded from field 'word') # 531| if (list) # 532| { # 533|-> arg = list->word->word; # 534| if (arg == 0 || (legal_number (arg, count) == 0)) # 535| { Error: CLANG_WARNING: bash-5.2/builtins/common.c:578:9: warning[core.NullDereference]: Access to field 'word' results in a dereference of a null pointer (loaded from field 'word') # 576| } # 577| # 578|-> arg = list->word->word; # 579| if (arg == 0 || legal_number (arg, &sval) == 0) # 580| { Error: COMPILER_WARNING (CWE-563): bash-5.2/builtins/common.c: scope_hint: In function ‘builtin_arrayref_flags’ bash-5.2/builtins/common.c:1088:9: warning[-Wunused-variable]: unused variable ‘t’ # 1088 | char *t; # | ^ # 1086| int baseflags; # 1087| { # 1088|-> char *t; # 1089| int vflags; # 1090| Error: CPPCHECK_WARNING: bash-5.2/builtins/complete.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/builtins/complete.def:385:3: warning[deadcode.DeadStores]: Value stored to 'opt_given' is never read # 383| } # 384| # 385|-> opt_given = oflags.pflag = oflags.rflag = 0; # 386| oflags.Dflag = oflags.Eflag = oflags.Iflag = 0; # 387| Error: CPPCHECK_WARNING: bash-5.2/builtins/declare.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-457): bash-5.2/builtins/declare.def:387:7: warning[-Wmaybe-uninitialized]: ‘optchar’ may be used uninitialized # 387 | sh_invalidopt (optchar); # | ^~~~~~~~~~~~~~~~~~~~~~~ bash-5.2/builtins/declare.def:376:13: note: ‘optchar’ was declared here # 376 | char *optchar; # | ^~~~~~~ # 385| optchar = "-a"; # 386| # 387|-> sh_invalidopt (optchar); # 388| return (EXECUTION_FAILURE); # 389| } Error: COMPILER_WARNING (CWE-563): bash-5.2/builtins/declare.def:401:11: warning[-Wunused-but-set-variable]: variable ‘var_exists’ set but not used # 401 | int var_exists, array_exists, creating_array, array_subscript_assignment; # | ^~~~~~~~~~ # 399| #if defined (ARRAY_VARS) # 400| int making_array_special, compound_array_assign, simple_array_assign; # 401|-> int var_exists, array_exists, creating_array, array_subscript_assignment; # 402| #endif # 403| Error: CLANG_WARNING: bash-5.2/builtins/declare.def:563:7: warning[deadcode.DeadStores]: Value stored to 'var_exists' is never read # 561| #if defined (ARRAY_VARS) # 562| /* Determine whether we are creating or assigning an array variable */ # 563|-> var_exists = array_exists = creating_array = 0; # 564| compound_array_assign = simple_array_assign = 0; # 565| array_subscript_assignment = 0; Error: CLANG_WARNING: bash-5.2/builtins/declare.def:563:20: warning[deadcode.DeadStores]: Although the value stored to 'array_exists' is used in the enclosing expression, the value is never actually read from 'array_exists' # 561| #if defined (ARRAY_VARS) # 562| /* Determine whether we are creating or assigning an array variable */ # 563|-> var_exists = array_exists = creating_array = 0; # 564| compound_array_assign = simple_array_assign = 0; # 565| array_subscript_assignment = 0; Error: CLANG_WARNING: bash-5.2/builtins/declare.def:563:35: warning[deadcode.DeadStores]: Although the value stored to 'creating_array' is used in the enclosing expression, the value is never actually read from 'creating_array' # 561| #if defined (ARRAY_VARS) # 562| /* Determine whether we are creating or assigning an array variable */ # 563|-> var_exists = array_exists = creating_array = 0; # 564| compound_array_assign = simple_array_assign = 0; # 565| array_subscript_assignment = 0; Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/declare.def: scope_hint: In function ‘declare_internal’ bash-5.2/builtins/declare.def:566:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 566 | if (t = strchr (name, '[')) /* ] */ # | ^ # 564| compound_array_assign = simple_array_assign = 0; # 565| array_subscript_assignment = 0; # 566|-> if (t = strchr (name, '[')) /* ] */ # 567| { # 568| /* If offset != 0 we have already validated any array reference Error: CLANG_WARNING: bash-5.2/builtins/declare.def:780:7: warning[deadcode.DeadStores]: Value stored to 'var_exists' is never read # 778| nameref variable we dereferenced to get VAR, if any. */ # 779| #if defined (ARRAY_VARS) # 780|-> var_exists = var != 0; # 781| array_exists = var && (array_p (var) || assoc_p (var)); # 782| creating_array = flags_on & (att_array|att_assoc); Error: CPPCHECK_WARNING: bash-5.2/builtins/echo.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/echo.def: scope_hint: In function ‘echo_builtin’ bash-5.2/builtins/echo.def:141:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 141 | while (i = *temp++) # | ^ # 139| /* All of the options in TEMP are valid options to ECHO. # 140| Handle them. */ # 141|-> while (i = *temp++) # 142| { # 143| switch (i) Error: CPPCHECK_WARNING: bash-5.2/builtins/enable.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-457): bash-5.2/builtins/enable.def: scope_hint: In function ‘enable_builtin’ bash-5.2/builtins/enable.def:192:16: warning[-Wmaybe-uninitialized]: ‘filename’ may be used uninitialized # 192 | result = dyn_load_builtin (list, filter, filename); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bash-5.2/builtins/enable.def:116:9: note: ‘filename’ was declared here # 116 | char *filename; # | ^~~~~~~~ # 190| filter |= SPECIAL; # 191| # 192|-> result = dyn_load_builtin (list, filter, filename); # 193| if (result != EXECUTION_SUCCESS) # 194| result = EXECUTION_FAILURE; /* normalize return value */ Error: CPPCHECK_WARNING: bash-5.2/builtins/evalfile.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/builtins/evalfile.c:273:5: warning[deadcode.DeadStores]: Value stored to 'result' is never read # 271| # 272| if (flags & FEVAL_BUILTIN) # 273|-> result = EXECUTION_SUCCESS; # 274| # 275| return_val = setjmp_nosigs (return_catch); Error: CPPCHECK_WARNING: bash-5.2/builtins/evalstring.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/evalstring.c: scope_hint: In function ‘parse_and_execute’ bash-5.2/builtins/evalstring.c:443:20: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 443 | else if (command = global_command) # | ^~~~~~~ # 441| global_command = (COMMAND *)NULL; # 442| } # 443|-> else if (command = global_command) # 444| { # 445| struct fd_bitmap *bitmap; Error: COMPILER_WARNING (CWE-563): bash-5.2/builtins/evalstring.c: scope_hint: In function ‘open_redir_file’ bash-5.2/builtins/evalstring.c:735:11: warning[-Wunused-variable]: unused variable ‘rval’ # 735 | int fd, rval; # | ^~~~ # 733| { # 734| char *fn; # 735|-> int fd, rval; # 736| # 737| if (r->instruction != r_input_direction) Error: CPPCHECK_WARNING: bash-5.2/builtins/exec.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/builtins/exec.def:233:16: warning[unix.Malloc]: Use of memory after it is freed # 231| #endif # 232| # 233|-> exit_value = shell_execve (command, args, env); # 234| # 235| /* We have to set this to NULL because shell_execve has called realloc() Error: CPPCHECK_WARNING: bash-5.2/builtins/exit.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/builtins/fc.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/builtins/getopt.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/getopt.c: scope_hint: In function ‘sh_getopt’ bash-5.2/builtins/getopt.c:182:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 182 | if (sh_badopt = (temp == NULL || c == ':')) # | ^~~~~~~~~ # 180| } # 181| # 182|-> if (sh_badopt = (temp == NULL || c == ':')) # 183| { # 184| if (sh_opterr) Error: CPPCHECK_WARNING: bash-5.2/builtins/getopts.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/builtins/hash.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/builtins/help.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/help.def: scope_hint: In function ‘help_builtin’ bash-5.2/builtins/help.def:145:23: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 145 | for (i = 0; name = shell_builtins[i].name; i++) # | ^~~~ # 143| for (pass = 1, this_found = 0; pass < 3; pass++) # 144| { # 145|-> for (i = 0; name = shell_builtins[i].name; i++) # 146| { # 147| QUIT; Error: GCC_ANALYZER_WARNING (CWE-775): bash-5.2/builtins/help.def: scope_hint: In function ‘show_longdoc’ bash-5.2/builtins/help.def:245:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open_helpfile(*doc)’ # 243| { # 244| fd = open_helpfile (doc[0]); # 245|-> if (fd < 0) # 246| return; # 247| zcatfd (fd, 1, doc[0]); Error: COMPILER_WARNING (CWE-563): bash-5.2/builtins/help.def: scope_hint: In function ‘show_desc’ bash-5.2/builtins/help.def:260:19: warning[-Wunused-but-set-variable]: variable ‘r’ set but not used # 260 | register int j, r; # | ^ # 258| int i; # 259| { # 260|-> register int j, r; # 261| char **doc, *line; # 262| int fd, usefile; Error: GCC_ANALYZER_WARNING (CWE-775): bash-5.2/builtins/help.def: scope_hint: In function ‘show_desc’ bash-5.2/builtins/help.def:270:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open_helpfile(*doc)’ # 268| { # 269| fd = open_helpfile (doc[0]); # 270|-> if (fd < 0) # 271| return; # 272| r = zmapfd (fd, &line, doc[0]); Error: CLANG_WARNING: bash-5.2/builtins/help.def:272:7: warning[deadcode.DeadStores]: Value stored to 'r' is never read # 270| if (fd < 0) # 271| return; # 272|-> r = zmapfd (fd, &line, doc[0]); # 273| close (fd); # 274| /* XXX - handle errors if zmapfd returns < 0 */ Error: GCC_ANALYZER_WARNING (CWE-775): bash-5.2/builtins/help.def: scope_hint: In function ‘show_manpage’ bash-5.2/builtins/help.def:309:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open_helpfile(*doc)’ # 307| { # 308| fd = open_helpfile (doc[0]); # 309|-> if (fd < 0) # 310| return; # 311| zmapfd (fd, &line, doc[0]); Error: CLANG_WARNING: bash-5.2/builtins/help.def:336:19: warning[core.NullDereference]: Array access (from variable 'doc') results in a null pointer dereference # 334| if (usefile == 0) # 335| { # 336|-> for (j = 0; doc[j]; j++) # 337| printf ("%*s%s\n", BASE_INDENT, " ", _(doc[j])); # 338| } Error: GCC_ANALYZER_WARNING (CWE-476): bash-5.2/builtins/help.def:336:22: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘doc’ # 334| if (usefile == 0) # 335| { # 336|-> for (j = 0; doc[j]; j++) # 337| printf ("%*s%s\n", BASE_INDENT, " ", _(doc[j])); # 338| } Error: COMPILER_WARNING (CWE-563): bash-5.2/builtins/help.def:518:10: warning[-Wunused-variable]: unused variable ‘j’ # 518 | int i, j; # | ^ # 516| show_builtin_command_help () # 517| { # 518|-> int i, j; # 519| int height, width; # 520| char *t, blurb[128]; Error: COMPILER_WARNING (CWE-563): bash-5.2/builtins/help.def: scope_hint: In function ‘show_builtin_command_help’ bash-5.2/builtins/help.def:520:9: warning[-Wunused-variable]: unused variable ‘t’ # 520 | char *t, blurb[128]; # | ^ # 518| int i, j; # 519| int height, width; # 520|-> char *t, blurb[128]; # 521| # 522| printf ( Error: CPPCHECK_WARNING: bash-5.2/builtins/history.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-457): bash-5.2/builtins/history.def: scope_hint: In function ‘history_builtin’ bash-5.2/builtins/history.def:185:59: warning[-Wmaybe-uninitialized]: ‘delete_arg’ may be used uninitialized # 185 | else if ((flags & DFLAG) && (range = strchr ((delete_arg[0] == '-') ? delete_arg + 1 : delete_arg, '-'))) # | ~~~~~~~~~~^~~ bash-5.2/builtins/history.def:112:20: note: ‘delete_arg’ was declared here # 112 | char *filename, *delete_arg, *range; # | ^~~~~~~~~~ # 183| } # 184| #endif # 185|-> else if ((flags & DFLAG) && (range = strchr ((delete_arg[0] == '-') ? delete_arg + 1 : delete_arg, '-'))) # 186| { # 187| intmax_t delete_start, delete_end; Error: CPPCHECK_WARNING: bash-5.2/builtins/kill.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING (CWE-457): bash-5.2/builtins/let.def:108: warning[uninitvar]: Uninitialized variable: ret # 106| } # 107| # 108|-> return ((ret == 0) ? EXECUTION_FAILURE : EXECUTION_SUCCESS); # 109| } # 110| Error: CPPCHECK_WARNING: bash-5.2/builtins/mapfile.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/builtins/mapfile.def:165:3: warning[deadcode.DeadStores]: Value stored to 'unbuffered_read' is never read # 163| line = NULL; # 164| line_length = 0; # 165|-> unbuffered_read = 0; # 166| # 167| /* The following check should be done before reading any lines. Doing it Error: CPPCHECK_WARNING: bash-5.2/builtins/mkbuiltins.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-131): bash-5.2/builtins/mkbuiltins.c: scope_hint: In function ‘array_add’ bash-5.2/builtins/mkbuiltins.c:452:18: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size bash-5.2/builtins/mkbuiltins.c:1112:15: note: in expansion of macro ‘savestring’ bash-5.2/builtins/mkbuiltins.c:1112:15: note: in expansion of macro ‘savestring’ bash-5.2/builtins/mkbuiltins.c:1113:19: note: in expansion of macro ‘savestring’ bash-5.2/builtins/mkbuiltins.c:1113:19: note: in expansion of macro ‘savestring’ # 450| { # 451| if (array->sindex + 2 > array->size) # 452|-> array->array = (char **)xrealloc # 453| (array->array, (array->size += array->growth_rate) * array->width); # 454| Error: GCC_ANALYZER_WARNING (CWE-401): bash-5.2/builtins/mkbuiltins.c:457:1: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’ bash-5.2/builtins/mkbuiltins.c:1112:15: note: in expansion of macro ‘savestring’ bash-5.2/builtins/mkbuiltins.c:1112:15: note: in expansion of macro ‘savestring’ bash-5.2/builtins/mkbuiltins.c:1113:19: note: in expansion of macro ‘savestring’ bash-5.2/builtins/mkbuiltins.c:1113:19: note: in expansion of macro ‘savestring’ # 455| array->array[array->sindex++] = element; # 456| array->array[array->sindex] = (char *)NULL; # 457|-> } # 458| # 459| /* Free an allocated array and data pointer. */ Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/mkbuiltins.c: scope_hint: In function ‘extract_info’ bash-5.2/builtins/mkbuiltins.c:603:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 603 | for (i = 0; line = defs->lines->array[i]; i++) # | ^~~~ # 601| # 602| /* Process each line in the array. */ # 603|-> for (i = 0; line = defs->lines->array[i]; i++) # 604| { # 605| defs->line_number = i; Error: CLANG_WARNING: bash-5.2/builtins/mkbuiltins.c:603:22: warning[core.NullDereference]: Array access (via field 'array') results in a null pointer dereference # 601| # 602| /* Process each line in the array. */ # 603|-> for (i = 0; line = defs->lines->array[i]; i++) # 604| { # 605| defs->line_number = i; Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/mkbuiltins.c: scope_hint: In function ‘free_defs’ bash-5.2/builtins/mkbuiltins.c:719:19: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 719 | for (i = 0; builtin = (BUILTIN_DESC *)defs->builtins->array[i]; i++) # | ^~~~~~~ # 717| if (defs->builtins) # 718| { # 719|-> for (i = 0; builtin = (BUILTIN_DESC *)defs->builtins->array[i]; i++) # 720| { # 721| free_builtin (builtin); Error: CPPCHECK_WARNING: bash-5.2/builtins/printf.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/builtins/printf.def:786:3: warning[deadcode.DeadStores]: Value stored to 'mfw' is never read # 784| ljust = fw = 0; # 785| pr = -1; # 786|-> mfw = 0; # 787| mpr = -1; # 788| Error: CLANG_WARNING: bash-5.2/builtins/printf.def:787:3: warning[deadcode.DeadStores]: Value stored to 'mpr' is never read # 785| pr = -1; # 786| mfw = 0; # 787|-> mpr = -1; # 788| # 789| /* skip flags */ Error: GCC_ANALYZER_WARNING (CWE-479): bash-5.2/builtins/psize.c: scope_hint: In function ‘sigpipe’ bash-5.2/builtins/psize.c:54:3: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘fprintf’ from within signal handler # 52| int sig; # 53| { # 54|-> fprintf (stderr, "%d\n", nw); # 55| exit (0); # 56| } Error: GCC_ANALYZER_WARNING (CWE-479): bash-5.2/builtins/psize.c:55:3: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘exit’ from within signal handler bash-5.2/builtins/psize.c:55:3: note: ‘_exit’ is a possible signal-safe alternative for ‘exit’ # 53| { # 54| fprintf (stderr, "%d\n", nw); # 55|-> exit (0); # 56| } # 57| Error: CPPCHECK_WARNING: bash-5.2/builtins/pushd.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/builtins/pushd.def:339:4: warning[deadcode.DeadStores]: Value stored to 'list' is never read # 337| else if (ISOPTION (list->word->word, '-')) # 338| { # 339|-> list = list->next; # 340| break; # 341| } Error: CLANG_WARNING: bash-5.2/builtins/pushd.def:437:4: warning[deadcode.DeadStores]: Value stored to 'list' is never read # 435| else if (ISOPTION (list->word->word, '-')) # 436| { # 437|-> list = list->next; # 438| break; # 439| } Error: CPPCHECK_WARNING: bash-5.2/builtins/read.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/builtins/read.def:144:20: warning[-Wunused-variable]: ‘old_alrm’ defined but not used # 144 | static SigHandler *old_alrm; # | ^~~~~~~~ # 142| # 143| static int reading, tty_modified; # 144|-> static SigHandler *old_alrm; # 145| static unsigned char delim; # 146| Error: CLANG_WARNING: bash-5.2/builtins/read.def:274:17: warning[deadcode.DeadStores]: Although the value stored to 'input_is_tty' is used in the enclosing expression, the value is never actually read from 'input_is_tty' # 272| mb_cur_max = MB_CUR_MAX; # 273| tmsec = tmusec = 0; /* no timeout */ # 274|-> nr = nchars = input_is_tty = input_is_pipe = unbuffered_read = have_timeout = 0; # 275| delim = '\n'; /* read until newline */ # 276| ignore_delim = nflag = 0; Error: CPPCHECK_WARNING (CWE-476): bash-5.2/builtins/read.def:795: error[nullPointer]: Null pointer dereference # 793| { # 794| size_t clen; # 795|-> clen = mbrlen (rlbuf + rlind - 1, mb_cur_max, (mbstate_t *)NULL); # 796| /* We only deal with valid multibyte sequences longer than one # 797| byte. If we get anything else, we leave the one character Error: GCC_ANALYZER_WARNING (CWE-457): bash-5.2/builtins/read.def: scope_hint: In function ‘read_builtin’ bash-5.2/builtins/read.def:917:11: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘saw_escape’ # 915| #endif # 916| # 917|-> if (saw_escape) # 918| { # 919| t = dequote_string (input_string); Error: CLANG_WARNING: bash-5.2/builtins/read.def:917:11: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value # 915| #endif # 916| # 917|-> if (saw_escape) # 918| { # 919| t = dequote_string (input_string); Error: CLANG_WARNING: bash-5.2/builtins/read.def:1030:7: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value # 1028| #endif # 1029| # 1030|-> if (saw_escape && input_string && *input_string) # 1031| { # 1032| t = dequote_string (input_string); Error: CPPCHECK_WARNING: bash-5.2/builtins/set.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING (CWE-457): bash-5.2/builtins/set.def:573: warning[uninitvar]: Uninitialized variable: tflag # 571| for (i = vptr = 0; o_options[i].name; i++) # 572| { # 573|-> if (tflag[i]) # 574| { # 575| strcpy (value + vptr, o_options[i].name); Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/set.def: scope_hint: In function ‘parse_shellopts’ bash-5.2/builtins/set.def:617:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 617 | while (vname = extract_colon_unit (value, &vptr)) # | ^~~~~ # 615| # 616| vptr = 0; # 617|-> while (vname = extract_colon_unit (value, &vptr)) # 618| { # 619| set_minus_o_option (FLAG_ON, vname); Error: CLANG_WARNING: bash-5.2/builtins/set.def:719:11: warning[core.NullDereference]: Array access (from variable 'arg') results in a null pointer dereference # 717| /* If the argument is `--' or `-' then signal the end of the list # 718| and remember the remaining arguments. */ # 719|-> if (arg[0] == '-' && (!arg[1] || (arg[1] == '-' && !arg[2]))) # 720| { # 721| list = list->next; Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/set.def: scope_hint: In function ‘set_builtin’ bash-5.2/builtins/set.def:742:18: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 742 | while (flag_name = *++arg) # | ^~~~~~~~~ # 740| if ((on_or_off = *arg) && (on_or_off == '-' || on_or_off == '+')) # 741| { # 742|-> while (flag_name = *++arg) # 743| { # 744| if (flag_name == '?') Error: CLANG_WARNING: bash-5.2/builtins/set.def:773:5: warning[deadcode.DeadStores]: Value stored to 'opts_changed' is never read # 771| list = list->next; /* Skip over option name. */ # 772| # 773|-> opts_changed = 1; # 774| if ((r = set_minus_o_option (on_or_off, option_name)) != EXECUTION_SUCCESS) # 775| { Error: CLANG_WARNING: bash-5.2/builtins/set.def:841:20: warning[deadcode.DeadStores]: Although the value stored to 'unset_variable' is used in the enclosing expression, the value is never actually read from 'unset_variable' # 839| char *name, *tname; # 840| # 841|-> unset_function = unset_variable = unset_array = nameref = any_failed = 0; # 842| global_unset_func = global_unset_var = 0; # 843| Error: CLANG_WARNING: bash-5.2/builtins/set.def:841:37: warning[deadcode.DeadStores]: Although the value stored to 'unset_array' is used in the enclosing expression, the value is never actually read from 'unset_array' # 839| char *name, *tname; # 840| # 841|-> unset_function = unset_variable = unset_array = nameref = any_failed = 0; # 842| global_unset_func = global_unset_var = 0; # 843| Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/set.def: scope_hint: In function ‘unset_builtin’ bash-5.2/builtins/set.def:946:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 946 | if (var = find_function (name)) # | ^~~ # 944| if (var == 0 && nameref == 0 && unset_variable == 0 && unset_function == 0) # 945| { # 946|-> if (var = find_function (name)) # 947| unset_function = 1; # 948| } Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/set.def:990:23: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 990 | if (var = array_variable_part (tname, 0, &t, &len)) # | ^~~ # 988| # 989| tname = savestring (nameref_cell (var)); # 990|-> if (var = array_variable_part (tname, 0, &t, &len)) # 991| { # 992| /* change to what unbind_array_element now expects */ Error: COMPILER_WARNING (CWE-457): bash-5.2/builtins/set.def:1013:10: warning[-Wmaybe-uninitialized]: ‘tem’ may be used uninitialized # 1013 | if (tem == -1 && nameref == 0 && unset_function == 0 && unset_variable == 0) # | ^ bash-5.2/builtins/set.def:882:11: note: ‘tem’ was declared here # 882 | int tem; # | ^~~ # 1011| that name does not exist, a function by that name, if any, # 1012| shall be unset.'' */ # 1013|-> if (tem == -1 && nameref == 0 && unset_function == 0 && unset_variable == 0) # 1014| tem = unbind_func (name); # 1015| Error: CLANG_WARNING: bash-5.2/builtins/set.def:1013:15: warning[core.UndefinedBinaryOperatorResult]: The left operand of '==' is a garbage value # 1011| that name does not exist, a function by that name, if any, # 1012| shall be unset.'' */ # 1013|-> if (tem == -1 && nameref == 0 && unset_function == 0 && unset_variable == 0) # 1014| tem = unbind_func (name); # 1015| Error: CLANG_WARNING: bash-5.2/builtins/set.def:1014:2: warning[deadcode.DeadStores]: Value stored to 'tem' is never read # 1012| shall be unset.'' */ # 1013| if (tem == -1 && nameref == 0 && unset_function == 0 && unset_variable == 0) # 1014|-> tem = unbind_func (name); # 1015| # 1016| name = list->word->word; /* reset above for namerefs */ Error: CPPCHECK_WARNING: bash-5.2/builtins/setattr.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/setattr.def: scope_hint: In function ‘set_or_show_attributes’ bash-5.2/builtins/setattr.def:320:23: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 320 | for (i = 0; var = variable_list[i]; i++) # | ^~~ # 318| if (variable_list) # 319| { # 320|-> for (i = 0; var = variable_list[i]; i++) # 321| { # 322| #if defined (ARRAY_VARS) Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/setattr.def:337:23: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 337 | if (any_failed = sh_chkwrite (any_failed)) # | ^~~~~~~~~~ # 335| { # 336| show_var_attributes (var, READONLY_OR_EXPORT, nodefs); # 337|-> if (any_failed = sh_chkwrite (any_failed)) # 338| break; # 339| } Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/setattr.def: scope_hint: In function ‘show_all_var_attributes’ bash-5.2/builtins/setattr.def:364:28: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 364 | for (i = any_failed = 0; var = variable_list[i]; i++) # | ^~~ # 362| return (EXECUTION_SUCCESS); # 363| # 364|-> for (i = any_failed = 0; var = variable_list[i]; i++) # 365| { # 366| /* There is no equivalent `declare -'. */ Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/setattr.def:371:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 371 | if (any_failed = sh_chkwrite (any_failed)) # | ^~~~~~~~~~ # 369| else # 370| show_var_attributes (var, READONLY_OR_EXPORT, nodefs); # 371|-> if (any_failed = sh_chkwrite (any_failed)) # 372| break; # 373| } Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/setattr.def: scope_hint: In function ‘show_local_var_attributes’ bash-5.2/builtins/setattr.def:392:28: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 392 | for (i = any_failed = 0; var = variable_list[i]; i++) # | ^~~ # 390| return (EXECUTION_SUCCESS); # 391| # 392|-> for (i = any_failed = 0; var = variable_list[i]; i++) # 393| { # 394| /* There is no equivalent `declare -'. */ Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/setattr.def:399:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 399 | if (any_failed = sh_chkwrite (any_failed)) # | ^~~~~~~~~~ # 397| else # 398| show_var_attributes (var, READONLY_OR_EXPORT, nodefs); # 399|-> if (any_failed = sh_chkwrite (any_failed)) # 400| break; # 401| } Error: CLANG_WARNING: bash-5.2/builtins/shift.def:85:17: warning[deadcode.DeadStores]: Although the value stored to 'itimes' is used in the enclosing expression, the value is never actually read from 'itimes' # 83| clear_dollar_vars (); # 84| else # 85|-> shift_args (itimes = times); # 86| # 87| invalidate_cached_quoted_dollar_at (); Error: CPPCHECK_WARNING: bash-5.2/builtins/shopt.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/builtins/shopt.def:335:3: warning[deadcode.DeadStores]: Value stored to 'rval' is never read # 333| } # 334| # 335|-> rval = EXECUTION_SUCCESS; # 336| if ((flags & OFLAG) && ((flags & (SFLAG|UFLAG)) == 0)) /* shopt -o */ # 337| rval = list_shopt_o_options (list, flags); Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/shopt.def: scope_hint: In function ‘toggle_shopts’ bash-5.2/builtins/shopt.def:482:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 482 | if (v = find_variable ("BASHOPTS")) # | ^ # 480| # 481| /* Don't set $BASHOPTS here if it hasn't already been initialized */ # 482|-> if (v = find_variable ("BASHOPTS")) # 483| set_bashopts (); # 484| return (rval); Error: CLANG_WARNING: bash-5.2/builtins/shopt.def:482:7: warning[deadcode.DeadStores]: Although the value stored to 'v' is used in the enclosing expression, the value is never actually read from 'v' # 480| # 481| /* Don't set $BASHOPTS here if it hasn't already been initialized */ # 482|-> if (v = find_variable ("BASHOPTS")) # 483| set_bashopts (); # 484| return (rval); Error: GCC_ANALYZER_WARNING (CWE-457): bash-5.2/builtins/shopt.def: scope_hint: In function ‘set_compatibility_level’ bash-5.2/builtins/shopt.def:712:11: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘oldval’ # 710| else if (shopt_compat44) # 711| shell_compatibility_level = 44; # 712|-> else if (oldval > 44 && shell_compatibility_level < DEFAULT_COMPAT_LEVEL) # 713| ; # 714| else Error: COMPILER_WARNING (CWE-457): bash-5.2/builtins/shopt.def: scope_hint: In function ‘set_compatibility_level’ bash-5.2/builtins/shopt.def:712:11: warning[-Wmaybe-uninitialized]: ‘oldval’ may be used uninitialized # 712 | else if (oldval > 44 && shell_compatibility_level < DEFAULT_COMPAT_LEVEL) # | ^ bash-5.2/builtins/shopt.def:677:12: note: ‘oldval’ was declared here # 677 | int ind, oldval; # | ^~~~~~ # 710| else if (shopt_compat44) # 711| shell_compatibility_level = 44; # 712|-> else if (oldval > 44 && shell_compatibility_level < DEFAULT_COMPAT_LEVEL) # 713| ; # 714| else Error: CLANG_WARNING: bash-5.2/builtins/shopt.def:712:19: warning[core.UndefinedBinaryOperatorResult]: The left operand of '>' is a garbage value # 710| else if (shopt_compat44) # 711| shell_compatibility_level = 44; # 712|-> else if (oldval > 44 && shell_compatibility_level < DEFAULT_COMPAT_LEVEL) # 713| ; # 714| else Error: COMPILER_WARNING (CWE-563): bash-5.2/builtins/shopt.def: scope_hint: In function ‘set_bashopts’ bash-5.2/builtins/shopt.def:854:24: warning[-Wunused-variable]: unused variable ‘ip’ # 854 | int vsize, i, vptr, *ip, exported; # | ^~ # 852| char *value; # 853| char tflag[N_SHOPT_OPTIONS]; # 854|-> int vsize, i, vptr, *ip, exported; # 855| SHELL_VAR *v; # 856| Error: CPPCHECK_WARNING (CWE-457): bash-5.2/builtins/shopt.def:871: warning[uninitvar]: Uninitialized variable: tflag # 869| for (i = vptr = 0; shopt_vars[i].name; i++) # 870| { # 871|-> if (tflag[i]) # 872| { # 873| strcpy (value + vptr, shopt_vars[i].name); Error: CLANG_WARNING: bash-5.2/builtins/shopt.def:871:11: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value # 869| for (i = vptr = 0; shopt_vars[i].name; i++) # 870| { # 871|-> if (tflag[i]) # 872| { # 873| strcpy (value + vptr, shopt_vars[i].name); Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/shopt.def: scope_hint: In function ‘parse_bashopts’ bash-5.2/builtins/shopt.def:915:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 915 | while (vname = extract_colon_unit (value, &vptr)) # | ^~~~~ # 913| # 914| vptr = 0; # 915|-> while (vname = extract_colon_unit (value, &vptr)) # 916| { # 917| ind = find_shopt (vname); Error: CPPCHECK_WARNING: bash-5.2/builtins/source.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/builtins/trap.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/builtins/trap.def:168:13: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'first_arg') # 166| return (EX_USAGE); # 167| } # 168|-> else if (*first_arg == '\0') # 169| operation = IGNORE; # 170| else if (first_arg[0] == '-' && !first_arg[1]) Error: CPPCHECK_WARNING: bash-5.2/builtins/type.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/builtins/type.def:251:46: warning[deadcode.DeadStores]: Although the value stored to 'i' is used in the enclosing expression, the value is never actually read from 'i' # 249| # 250| /* Command is a shell reserved word? */ # 251|-> if (((dflags & CDESC_FORCE_PATH) == 0) && (i = find_reserved_word (command)) >= 0) # 252| { # 253| if (dflags & CDESC_TYPE) Error: COMPILER_WARNING (CWE-569): bash-5.2/builtins/type.def: scope_hint: In function ‘describe_command’ bash-5.2/builtins/type.def:338:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 338 | if (full_path = phash_search (command)) # | ^~~~~~~~~ # 336| if (all == 0 || (dflags & CDESC_FORCE_PATH)) # 337| { # 338|-> if (full_path = phash_search (command)) # 339| { # 340| if (dflags & CDESC_TYPE) Error: GCC_ANALYZER_WARNING (CWE-688): bash-5.2/builtins/type.def: scope_hint: In function ‘describe_command’ bash-5.2/builtins/type.def:410:9: warning[-Wanalyzer-null-argument]: use of NULL ‘full_path’ where non-null expected bash-5.2/shell.h:29: included_from: Included from here. bash-5.2/builtins/type.def:66: included_from: Included from here. bash-5.2/builtins/type.def:374:11: note: in expansion of macro ‘STREQ’ <built-in>: note: argument 1 of ‘__builtin_puts’ must be non-null # 408| printf (_("%s is %s\n"), command, full_path); # 409| else if (dflags & (CDESC_REUSABLE|CDESC_PATH_ONLY)) # 410|-> printf ("%s\n", full_path); # 411| # 412| free (full_path); Error: CPPCHECK_WARNING: bash-5.2/builtins/ulimit.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/builtins/ulimit.def:437:7: warning[deadcode.DeadStores]: Value stored to 'list' is never read # 435| { # 436| cmdlist[ncmd - 1].arg = list->word->word; # 437|-> list = list->next; # 438| } # 439| Error: COMPILER_WARNING (CWE-1164): bash-5.2/builtins/ulimit.def:783:1: warning[-Wunused-function]: ‘set_all_limits’ defined but not used # 783 | set_all_limits (mode, newlim) # | ^~~~~~~~~~~~~~ # 781| # 782| static int # 783|-> set_all_limits (mode, newlim) # 784| int mode; # 785| RLIMTYPE newlim; Error: CLANG_WARNING: bash-5.2/builtins/umask.def:199:13: warning[deadcode.DeadStores]: Although the value stored to 'op' is used in the enclosing expression, the value is never actually read from 'op' # 197| for (s = mode, bits = initial_bits;;) # 198| { # 199|-> who = op = perm = 0; # 200| # 201| /* Parse the `who' portion of the symbolic mode clause. */ Error: CLANG_WARNING: bash-5.2/builtins/umask.def:204:12: warning[deadcode.DeadStores]: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c' # 202| while (member (*s, "agou")) # 203| { # 204|-> switch (c = *s++) # 205| { # 206| case 'u': Error: CPPCHECK_WARNING: bash-5.2/builtins/wait.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/builtins/wait.def: scope_hint: In function ‘wait_builtin’ bash-5.2/builtins/wait.def:117:14: warning[-Wunused-but-set-variable]: variable ‘pidvar’ set but not used # 117 | SHELL_VAR *pidvar; # | ^~~~~~ # 115| volatile int wflags; # 116| char *vname; # 117|-> SHELL_VAR *pidvar; # 118| struct procstat pstat; # 119| Error: CLANG_WARNING: bash-5.2/builtins/wait.def:238:7: warning[deadcode.DeadStores]: Value stored to 'opt' is never read # 236| if (list == 0) # 237| { # 238|-> opt = wait_for_background_pids (&pstat); # 239| #if 0 # 240| /* Compatibility with NetBSD sh: don't set VNAME since it doesn't Error: COMPILER_WARNING (CWE-563): bash-5.2/builtins/wait.def: scope_hint: In function ‘set_waitlist’ bash-5.2/builtins/wait.def:338:12: warning[-Wunused-variable]: unused variable ‘r’ # 338 | int job, r, njob; # | ^ # 336| { # 337| sigset_t set, oset; # 338|-> int job, r, njob; # 339| intmax_t pid; # 340| WORD_LIST *l; Error: CLANG_WARNING: bash-5.2/builtins/wait.def:346:7: warning[deadcode.DeadStores]: Value stored to 'job' is never read # 344| for (l = list; l; l = l->next) # 345| { # 346|-> job = NO_JOB; # 347| job = (l && legal_number (l->word->word, &pid) && pid == (pid_t) pid) # 348| ? get_job_by_pid ((pid_t) pid, 0, 0) Error: COMPILER_WARNING (CWE-569): bash-5.2/eval.c: scope_hint: In function ‘reader_loop’ bash-5.2/eval.c:148:20: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 148 | else if (current_command = global_command) # | ^~~~~~~~~~~~~~~ # 146| global_command = (COMMAND *)NULL; # 147| } # 148|-> else if (current_command = global_command) # 149| { # 150| global_command = (COMMAND *)NULL; Error: COMPILER_WARNING (CWE-252): bash-5.2/eval.c: scope_hint: In function ‘alrm_catcher’ bash-5.2/eval.c:245:3: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ # 245 | write (1, msg, strlen (msg)); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 243| # 244| msg = _("\007timed out waiting for input: auto-logout\n"); # 245|-> write (1, msg, strlen (msg)); # 246| # 247| bash_logout (); /* run ~/.bash_logout if this is a login shell */ Error: CPPCHECK_WARNING: bash-5.2/execute_cmd.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/execute_cmd.c:281:12: warning[-Wunused-variable]: ‘connection_count’ defined but not used # 281 | static int connection_count; # | ^~~~~~~~~~~~~~~~ # 279| static int showing_function_line; # 280| # 281|-> static int connection_count; # 282| # 283| /* $LINENO ($BASH_LINENO) for use by an ERR trap. Global so parse_and_execute Error: COMPILER_WARNING (CWE-457): bash-5.2/execute_cmd.c: scope_hint: In function ‘execute_command_internal’ bash-5.2/execute_cmd.c:1128:9: warning[-Wmaybe-uninitialized]: ‘ofifo_list’ may be used uninitialized # 1128 | close_new_fifos ((void *)ofifo_list, osize); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bash-5.2/execute_cmd.c:592:18: note: ‘ofifo_list’ was declared here # 592 | volatile void *ofifo_list; # | ^~~~~~~~~~ # 1126| nfifo = num_fifos (); # 1127| if (nfifo > ofifo) # 1128|-> close_new_fifos ((void *)ofifo_list, osize); # 1129| free ((void *)ofifo_list); # 1130| discard_unwind_frame ("internal_fifos"); Error: CPPCHECK_WARNING (CWE-457): bash-5.2/execute_cmd.c:1405: error[uninitvar]: Uninitialized variable: save_top_level # 1403| # 1404| old_flags = command->flags; # 1405|-> COPY_PROCENV (top_level, save_top_level); # 1406| command->flags &= ~(CMD_TIME_PIPELINE|CMD_TIME_POSIX); # 1407| code = setjmp_nosigs (top_level); Error: COMPILER_WARNING (CWE-1164): bash-5.2/execute_cmd.c: scope_hint: At top level bash-5.2/execute_cmd.c:1787:13: warning[-Wunused-function]: ‘cpl_prune’ declared ‘static’ but never defined # 1787 | static void cpl_prune PARAMS((void)); # | ^~~~~~~~~ # 1785| static struct cpelement *cpl_search PARAMS((pid_t)); # 1786| static struct cpelement *cpl_searchbyname PARAMS((const char *)); # 1787|-> static void cpl_prune PARAMS((void)); # 1788| # 1789| static void coproc_free PARAMS((struct coproc *)); Error: COMPILER_WARNING (CWE-1164): bash-5.2/execute_cmd.c:1818:1: warning[-Wunused-function]: ‘cpl_add’ defined but not used # 1818 | cpl_add (cp) # | ^~~~~~~ # 1816| # 1817| static struct cpelement * # 1818|-> cpl_add (cp) # 1819| Coproc *cp; # 1820| { Error: COMPILER_WARNING (CWE-1164): bash-5.2/execute_cmd.c:1841:1: warning[-Wunused-function]: ‘cpl_delete’ defined but not used # 1841 | cpl_delete (pid) # | ^~~~~~~~~~ # 1839| # 1840| static struct cpelement * # 1841|-> cpl_delete (pid) # 1842| pid_t pid; # 1843| { Error: COMPILER_WARNING (CWE-1164): bash-5.2/execute_cmd.c:1874:1: warning[-Wunused-function]: ‘cpl_reap’ defined but not used # 1874 | cpl_reap () # | ^~~~~~~~ # 1872| # 1873| static void # 1874|-> cpl_reap () # 1875| { # 1876| struct cpelement *p, *next, *nh, *nt; Error: COMPILER_WARNING (CWE-1164): bash-5.2/execute_cmd.c:1915:1: warning[-Wunused-function]: ‘cpl_flush’ defined but not used # 1915 | cpl_flush () # | ^~~~~~~~~ # 1913| /* Clear out the list of saved statuses */ # 1914| static void # 1915|-> cpl_flush () # 1916| { # 1917| struct cpelement *cpe, *p; Error: COMPILER_WARNING (CWE-1164): bash-5.2/execute_cmd.c:1933:1: warning[-Wunused-function]: ‘cpl_closeall’ defined but not used # 1933 | cpl_closeall () # | ^~~~~~~~~~~~ # 1931| # 1932| static void # 1933|-> cpl_closeall () # 1934| { # 1935| struct cpelement *cpe; Error: COMPILER_WARNING (CWE-1164): bash-5.2/execute_cmd.c:1942:1: warning[-Wunused-function]: ‘cpl_fdchk’ defined but not used # 1942 | cpl_fdchk (fd) # | ^~~~~~~~~ # 1940| # 1941| static void # 1942|-> cpl_fdchk (fd) # 1943| int fd; # 1944| { Error: COMPILER_WARNING (CWE-1164): bash-5.2/execute_cmd.c:1954:1: warning[-Wunused-function]: ‘cpl_search’ defined but not used # 1954 | cpl_search (pid) # | ^~~~~~~~~~ # 1952| found. If not found, return NULL. */ # 1953| static struct cpelement * # 1954|-> cpl_search (pid) # 1955| pid_t pid; # 1956| { Error: COMPILER_WARNING (CWE-1164): bash-5.2/execute_cmd.c:1968:1: warning[-Wunused-function]: ‘cpl_searchbyname’ defined but not used # 1968 | cpl_searchbyname (name) # | ^~~~~~~~~~~~~~~~ # 1966| cpelement struct if found. If not found, return NULL. */ # 1967| static struct cpelement * # 1968|-> cpl_searchbyname (name) # 1969| const char *name; # 1970| { Error: COMPILER_WARNING (CWE-1164): bash-5.2/execute_cmd.c:1980:1: warning[-Wunused-function]: ‘cpl_firstactive’ defined but not used # 1980 | cpl_firstactive () # | ^~~~~~~~~~~~~~~ # 1978| # 1979| static pid_t # 1980|-> cpl_firstactive () # 1981| { # 1982| struct cpelement *cpe; Error: COMPILER_WARNING (CWE-1164): bash-5.2/execute_cmd.c:2075:1: warning[-Wunused-function]: ‘coproc_free’ defined but not used # 2075 | coproc_free (cp) # | ^~~~~~~~~~~ # 2073| # 2074| static void # 2075|-> coproc_free (cp) # 2076| struct coproc *cp; # 2077| { Error: COMPILER_WARNING (CWE-563): bash-5.2/execute_cmd.c:3204:12: warning[-Wunused-variable]: ‘LINES’ defined but not used # 3204 | static int LINES, COLS, tabsize; # | ^~~~~ # 3202| # 3203| #if defined (SELECT_COMMAND) # 3204|-> static int LINES, COLS, tabsize; # 3205| # 3206| #define RP_SPACE ") " Error: COMPILER_WARNING (CWE-563): bash-5.2/execute_cmd.c: scope_hint: In function ‘select_query’ bash-5.2/execute_cmd.c:3341:23: warning[-Wunused-variable]: unused variable ‘t’ # 3341 | char *repl_string, *t; # | ^ # 3339| intmax_t reply; # 3340| WORD_LIST *l; # 3341|-> char *repl_string, *t; # 3342| # 3343| COLS = default_columns (); Error: CPPCHECK_WARNING: bash-5.2/expr.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/expr.c:415:3: warning[deadcode.DeadStores]: Value stored to 'val' is never read # 413| procenv_t oevalbuf; # 414| # 415|-> val = 0; # 416| noeval = 0; # 417| already_expanded = (flags&EXP_EXPANDED); Error: CLANG_WARNING: bash-5.2/expr.c:605:6: warning[unix.Malloc]: Use of memory after it is freed # 603| #if defined (ARRAY_VARS) # 604| if (lind != -1) # 605|-> expr_bind_array_element (lhs, lind, rhs); # 606| else # 607| #endif Error: CLANG_WARNING: bash-5.2/expr.c:608:6: warning[unix.Malloc]: Use of memory after it is freed # 606| else # 607| #endif # 608|-> expr_bind_variable (lhs, rhs); # 609| } # 610| if (curlval.tokstr && curlval.tokstr == tokstr) Error: CLANG_WARNING: bash-5.2/expr.c:614:7: warning[unix.Malloc]: Attempt to free released memory # 612| # 613| free (rhs); # 614|-> free (lhs); # 615| FREE (tokstr); # 616| tokstr = (char *)NULL; /* For freeing on errors. */ Error: COMPILER_WARNING (CWE-563): bash-5.2/expr.c: scope_hint: In function ‘exppower’ bash-5.2/expr.c:963:33: warning[-Wunused-variable]: unused variable ‘c’ # 963 | register intmax_t val1, val2, c; # | ^ # 961| exppower () # 962| { # 963|-> register intmax_t val1, val2, c; # 964| # 965| val1 = exp1 (); Error: COMPILER_WARNING (CWE-1164): bash-5.2/expr.c:1124:1: warning[-Wunused-function]: ‘alloc_lvalue’ defined but not used # 1124 | alloc_lvalue () # | ^~~~~~~~~~~~ # 1122| # 1123| static struct lvalue * # 1124|-> alloc_lvalue () # 1125| { # 1126| struct lvalue *lv; Error: COMPILER_WARNING (CWE-1164): bash-5.2/expr.c: scope_hint: At top level bash-5.2/expr.c:1134:1: warning[-Wunused-function]: ‘free_lvalue’ defined but not used # 1134 | free_lvalue (lv) # | ^~~~~~~~~~~ # 1132| # 1133| static void # 1134|-> free_lvalue (lv) # 1135| struct lvalue *lv; # 1136| { Error: COMPILER_WARNING (CWE-563): bash-5.2/expr.c: scope_hint: In function ‘readtok’ bash-5.2/expr.c:1316:17: warning[-Wunused-variable]: unused variable ‘lval’ # 1316 | struct lvalue lval; # | ^~~~ # 1314| register unsigned char c, c1; # 1315| register int e; # 1316|-> struct lvalue lval; # 1317| # 1318| /* Skip leading whitespace. */ Error: COMPILER_WARNING (CWE-563): bash-5.2/expr.c: scope_hint: In function ‘strlong’ bash-5.2/expr.c:1552:17: warning[-Wunused-variable]: unused variable ‘pval’ # 1552 | intmax_t val, pval; # | ^~~~ # 1550| register unsigned char c; # 1551| int base, foundbase; # 1552|-> intmax_t val, pval; # 1553| # 1554| s = num; Error: CPPCHECK_WARNING: bash-5.2/findcmd.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-569): bash-5.2/findcmd.c: scope_hint: In function ‘_find_user_command_internal’ bash-5.2/findcmd.c:269:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 269 | if (var = find_variable_tempenv ("PATH")) /* XXX could be array? */ # | ^~~ # 267| /* Search for the value of PATH in both the temporary environments and # 268| in the regular list of variables. */ # 269|-> if (var = find_variable_tempenv ("PATH")) /* XXX could be array? */ # 270| path_list = value_cell (var); # 271| else Error: CPPCHECK_WARNING (CWE-476): bash-5.2/findcmd.c:492: warning[nullPointer]: Possible null pointer dereference: match_list # 490| } # 491| # 492|-> match = match_list[match_index]; # 493| # 494| if (match) Error: CLANG_WARNING: bash-5.2/findcmd.c:492:11: warning[core.NullDereference]: Array access (from variable 'match_list') results in a null pointer dereference # 490| } # 491| # 492|-> match = match_list[match_index]; # 493| # 494| if (match) Error: CPPCHECK_WARNING: bash-5.2/general.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-665): bash-5.2/general.c:91:1: warning[-Wmissing-braces]: missing braces around initializer # 91 | { # | ^ # 92 | &interactive_comments, # | { } # 93 | &source_uses_path, # | { } # 94 | &expaliases_flag, # | { } # 95 | &inherit_errexit, # | { } # 96 | &print_shift_error, # | { } # 97 | 0 # | { # 98 | }; # | } # 89| int *posix_mode_var; # 90| } posix_vars[] = # 91|-> { # 92| &interactive_comments, # 93| &source_uses_path, Error: COMPILER_WARNING (CWE-569): bash-5.2/general.c: scope_hint: In function ‘assignment’ bash-5.2/general.c:459:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 459 | while (c = string[indx]) # | ^ # 457| return (0); # 458| # 459|-> while (c = string[indx]) # 460| { # 461| /* The following is safe. Note that '=' at the start of a word Error: GCC_ANALYZER_WARNING (CWE-688): bash-5.2/shell.h:29: included_from: Included from here. bash-5.2/expr.c:84: included_from: Included from here. bash-5.2/expr.c: scope_hint: In function ‘readtok’ bash-5.2/general.h:69:54: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected bash-5.2/expr.c:1369:16: note: in expansion of macro ‘savestring’ bash-5.2/expr.c: scope_hint: In function ‘readtok’ bash-5.2/expr.c: scope_hint: In function ‘readtok’ bash-5.2/expr.c: scope_hint: In function ‘readtok’ bash-5.2/expr.c: scope_hint: In function ‘readtok’ bash-5.2/expr.c:93:27: note: in expansion of macro ‘whitespace’ bash-5.2/expr.c:1321:30: note: in expansion of macro ‘cr_whitespace’ bash-5.2/general.h:172:27: note: in definition of macro ‘FREE’ bash-5.2/expr.c:1368:7: note: in expansion of macro ‘FREE’ bash-5.2/expr.c:1369:16: note: in expansion of macro ‘savestring’ bash-5.2/expr.c:1369:16: note: in expansion of macro ‘savestring’ bash-5.2/expr.c:1373:7: note: in expansion of macro ‘SAVETOK’ bash-5.2/expr.c:1373:7: note: in expansion of macro ‘SAVETOK’ bash-5.2/expr.c:1369:16: note: in expansion of macro ‘savestring’ <built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null # 67| # 68| #if !defined (savestring) # 69|-> # define savestring(x) (char *)strcpy (xmalloc (1 + strlen (x)), (x)) # 70| #endif # 71| Error: GCC_ANALYZER_WARNING (CWE-688): bash-5.2/shell.h:29: included_from: Included from here. bash-5.2/bashline.c:47: included_from: Included from here. bash-5.2/bashline.c: scope_hint: In function ‘bash_directory_expansion’ bash-5.2/general.h:69:54: warning[-Wanalyzer-null-argument]: use of NULL ‘dh2’ where non-null expected bash-5.2/bashline.c:3263:7: note: in expansion of macro ‘savestring’ bash-5.2/bashline.c:3263:7: note: in expansion of macro ‘savestring’ bash-5.2/bashline.c:3263:7: note: in expansion of macro ‘savestring’ <built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null # 67| # 68| #if !defined (savestring) # 69|-> # define savestring(x) (char *)strcpy (xmalloc (1 + strlen (x)), (x)) # 70| #endif # 71| Error: GCC_ANALYZER_WARNING (CWE-688): bash-5.2/shell.h:29: included_from: Included from here. bash-5.2/make_cmd.c:37: included_from: Included from here. bash-5.2/make_cmd.c: scope_hint: In function ‘make_here_document’ bash-5.2/general.h:152:30: warning[-Wanalyzer-null-argument]: use of NULL ‘document’ where non-null expected bash-5.2/make_cmd.c:665:7: note: in expansion of macro ‘FASTCOPY’ bash-5.2/make_cmd.c:665:7: note: in expansion of macro ‘FASTCOPY’ bash-5.2/general.h:152:49: note: in definition of macro ‘FASTCOPY’ bash-5.2/make_cmd.c:665:7: note: in expansion of macro ‘FASTCOPY’ <built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null # 150| # 151| #if __GNUC__ > 1 # 152|-> # define FASTCOPY(s, d, n) __builtin_memcpy ((d), (s), (n)) # 153| #else /* !__GNUC__ */ # 154| # if !defined (HAVE_BCOPY) Error: COMPILER_WARNING: bash-5.2/general.h:168:41: warning[-Wuse-after-free]: pointer ‘nestret_426’ may be used after ‘free’ # 168 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) # | ~~~^~~ bash-5.2/parse.y:3902:19: note: call to ‘free’ here # 3902 | free (nestret); # | ^~~~~~~~~~~~~~ # 166| #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0) # 167| #define STREQN(a, b, n) ((n == 0) ? (1) \ # 168|-> : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) # 169| # 170| /* More convenience definitions that possibly save system or libc calls. */ Error: COMPILER_WARNING: bash-5.2/general.h:168:41: warning[-Wuse-after-free]: pointer ‘t_408’ may be used after ‘free’ # 168 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) # | ~~~^~~ bash-5.2/subst.c:4290:15: note: call to ‘free’ here # 4290 | free (t); # | ^~~~~~~~ # 166| #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0) # 167| #define STREQN(a, b, n) ((n == 0) ? (1) \ # 168|-> : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) # 169| # 170| /* More convenience definitions that possibly save system or libc calls. */ Error: COMPILER_WARNING: bash-5.2/general.h:168:41: warning[-Wuse-after-free]: pointer ‘ttok_1105’ may be used after ‘free’ # 168 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) # | ~~~^~~ bash-5.2/parse.y:5099:19: note: call to ‘free’ here # 5099 | free (ttok); # | ^~~~~~~~~~~ # 166| #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0) # 167| #define STREQN(a, b, n) ((n == 0) ? (1) \ # 168|-> : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) # 169| # 170| /* More convenience definitions that possibly save system or libc calls. */ Error: COMPILER_WARNING: bash-5.2/parse.y: scope_hint: In function ‘parse_matched_pair’ bash-5.2/general.h:168:58: warning[-Wuse-after-free]: pointer ‘nestret_426’ may be used after ‘free’ # 168 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) # | ^~~~~~~~~~~~~~~~ bash-5.2/parse.y:3902:19: note: call to ‘free’ here # 3902 | free (nestret); # | ^~~~~~~~~~~~~~ # 166| #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0) # 167| #define STREQN(a, b, n) ((n == 0) ? (1) \ # 168|-> : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) # 169| # 170| /* More convenience definitions that possibly save system or libc calls. */ Error: COMPILER_WARNING: bash-5.2/shell.h:29: included_from: Included from here. bash-5.2/subst.c:46: included_from: Included from here. bash-5.2/subst.c: scope_hint: In function ‘expand_string_dollar_quote’ bash-5.2/general.h:168:58: warning[-Wuse-after-free]: pointer ‘t_408’ may be used after ‘free’ # 168 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) # | ^~~~~~~~~~~~~~~~ bash-5.2/subst.c:4290:15: note: call to ‘free’ here # 4290 | free (t); # | ^~~~~~~~ # 166| #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0) # 167| #define STREQN(a, b, n) ((n == 0) ? (1) \ # 168|-> : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) # 169| # 170| /* More convenience definitions that possibly save system or libc calls. */ Error: COMPILER_WARNING: bash-5.2/shell.h:29: included_from: Included from here. bash-5.2/parse.y:47: included_from: Included from here. bash-5.2/parse.y: scope_hint: In function ‘read_token_word’ bash-5.2/general.h:168:58: warning[-Wuse-after-free]: pointer ‘ttok_1105’ may be used after ‘free’ # 168 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) # | ^~~~~~~~~~~~~~~~ bash-5.2/parse.y:5099:19: note: call to ‘free’ here # 5099 | free (ttok); # | ^~~~~~~~~~~ # 166| #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0) # 167| #define STREQN(a, b, n) ((n == 0) ? (1) \ # 168|-> : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) # 169| # 170| /* More convenience definitions that possibly save system or libc calls. */ Error: COMPILER_WARNING (CWE-457): bash-5.2/subst.c: scope_hint: In function ‘parameter_brace_expand_length’ bash-5.2/general.h:171:78: warning[-Wmaybe-uninitialized]: ‘t’ may be used uninitialized # 171 | #define STRLEN(s) (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0) # | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~ bash-5.2/subst.c:7990:9: note: ‘t’ was declared here # 7990 | char *t, *newname; # | ^ # 169| # 170| /* More convenience definitions that possibly save system or libc calls. */ # 171|-> #define STRLEN(s) (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0) # 172| #define FREE(s) do { if (s) free (s); } while (0) # 173| #define MEMBER(c, s) (((c) && c == (s)[0] && !(s)[1]) || (member(c, s))) Error: CPPCHECK_WARNING: bash-5.2/hashcmd.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-1164): bash-5.2/hashlib.c:169:1: warning[-Wunused-function]: ‘hash_shrink’ defined but not used # 169 | hash_shrink (table) # | ^~~~~~~~~~~ # 167| # 168| static void # 169|-> hash_shrink (table) # 170| HASH_TABLE *table; # 171| { Error: CLANG_WARNING: bash-5.2/include/typemax.h:123:26: note: expanded from macro 'sh_imaxabs' # 121| # 122| #ifndef sh_imaxabs # 123|-> # define sh_imaxabs(x) (((x) >= 0) ? (x) : -(x)) # 124| #endif # 125| Error: CLANG_WARNING: bash-5.2/include/typemax.h:123:27: note: expanded from macro 'sh_imaxabs' # 121| # 122| #ifndef sh_imaxabs # 123|-> # define sh_imaxabs(x) (((x) >= 0) ? (x) : -(x)) # 124| #endif # 125| Error: CLANG_WARNING: bash-5.2/include/typemax.h:132:6: note: expanded from macro 'ADDOVERFLOW' # 130| Assumes that b > 0 if a > 0 and b < 0 if a < 0 */ # 131| #define ADDOVERFLOW(a,b,minv,maxv) \ # 132|-> ((((a) > 0) && ((b) > ((maxv) - (a)))) || \ # 133| (((a) < 0) && ((b) < ((minv) - (a))))) # 134| Error: CLANG_WARNING: bash-5.2/include/typemax.h:132:14: note: expanded from macro 'ADDOVERFLOW' # 130| Assumes that b > 0 if a > 0 and b < 0 if a < 0 */ # 131| #define ADDOVERFLOW(a,b,minv,maxv) \ # 132|-> ((((a) > 0) && ((b) > ((maxv) - (a)))) || \ # 133| (((a) < 0) && ((b) < ((minv) - (a))))) # 134| Error: CLANG_WARNING: bash-5.2/include/typemax.h:133:6: note: expanded from macro 'ADDOVERFLOW' # 131| #define ADDOVERFLOW(a,b,minv,maxv) \ # 132| ((((a) > 0) && ((b) > ((maxv) - (a)))) || \ # 133|-> (((a) < 0) && ((b) < ((minv) - (a))))) # 134| # 135| /* Make sure that a-b is not smaller than MINV or exceeds MAXV (if b < 0). Error: CLANG_WARNING: bash-5.2/include/typemax.h:133:14: note: expanded from macro 'ADDOVERFLOW' # 131| #define ADDOVERFLOW(a,b,minv,maxv) \ # 132| ((((a) > 0) && ((b) > ((maxv) - (a)))) || \ # 133|-> (((a) < 0) && ((b) < ((minv) - (a))))) # 134| # 135| /* Make sure that a-b is not smaller than MINV or exceeds MAXV (if b < 0). Error: CPPCHECK_WARNING: bash-5.2/input.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/input.c:373:28: warning[core.NullDereference]: Access to field 'b_flag' results in a dereference of a null pointer # 371| if (!buffers[fd2]) # 372| fd_to_buffered_stream (fd2); # 373|-> buffers[fd2]->b_flag |= B_WASBASHINPUT; # 374| } # 375| Error: CLANG_WARNING: bash-5.2/input.c:377:26: warning[core.NullDereference]: Access to field 'b_flag' results in a dereference of a null pointer # 375| # 376| if (fd_is_bash_input (fd1) || (buffers[fd1] && (buffers[fd1]->b_flag & B_SHAREDBUF))) # 377|-> buffers[fd2]->b_flag |= B_SHAREDBUF; # 378| # 379| return (fd2); Error: CPPCHECK_WARNING: bash-5.2/jobs.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/jobs.c: scope_hint: In function ‘procsub_waitall’ bash-5.2/jobs.c:1103:7: warning[-Wunused-but-set-variable]: variable ‘r’ set but not used # 1103 | int r; # | ^ # 1101| { # 1102| PROCESS *p; # 1103|-> int r; # 1104| # 1105| for (p = procsubs.head; p; p = p->next) Error: CLANG_WARNING: bash-5.2/jobs.c:1109:7: warning[deadcode.DeadStores]: Value stored to 'r' is never read # 1107| if (p->running == PS_DONE) # 1108| continue; # 1109|-> r = wait_for (p->pid, 0); # 1110| } # 1111| } Error: COMPILER_WARNING (CWE-563): bash-5.2/jobs.c:1136:20: warning[-Wunused-but-set-variable]: variable ‘oend’ set but not used # 1136 | PROCESS *ohead, *oend, *ps, *p; # | ^~~~ # 1134| procsub_prune () # 1135| { # 1136|-> PROCESS *ohead, *oend, *ps, *p; # 1137| int onproc; # 1138| Error: COMPILER_WARNING (CWE-563): bash-5.2/jobs.c: scope_hint: In function ‘procsub_prune’ bash-5.2/jobs.c:1137:7: warning[-Wunused-but-set-variable]: variable ‘onproc’ set but not used # 1137 | int onproc; # | ^~~~~~ # 1135| { # 1136| PROCESS *ohead, *oend, *ps, *p; # 1137|-> int onproc; # 1138| # 1139| if (procsubs.nproc == 0) Error: CLANG_WARNING: bash-5.2/jobs.c:1143:3: warning[deadcode.DeadStores]: Value stored to 'oend' is never read # 1141| # 1142| ohead = procsubs.head; # 1143|-> oend = procsubs.end; # 1144| onproc = procsubs.nproc; # 1145| Error: CLANG_WARNING: bash-5.2/jobs.c:1144:3: warning[deadcode.DeadStores]: Value stored to 'onproc' is never read # 1142| ohead = procsubs.head; # 1143| oend = procsubs.end; # 1144|-> onproc = procsubs.nproc; # 1145| # 1146| procsubs.head = procsubs.end = 0; Error: COMPILER_WARNING (CWE-563): bash-5.2/jobs.c: scope_hint: In function ‘cleanup_dead_jobs’ bash-5.2/jobs.c:1214:12: warning[-Wunused-variable]: unused variable ‘discard’ # 1214 | PROCESS *discard; # | ^~~~~~~ # 1212| register int i; # 1213| int os; # 1214|-> PROCESS *discard; # 1215| # 1216| if (js.j_jobslots == 0 || jobs_list_frozen) Error: COMPILER_WARNING (CWE-569): bash-5.2/jobs.c: scope_hint: In function ‘nohup_job’ bash-5.2/jobs.c:1457:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 1457 | if (temp = jobs[job_index]) # | ^~~~ # 1455| return; # 1456| # 1457|-> if (temp = jobs[job_index]) # 1458| temp->flags |= J_NOHUP; # 1459| } Error: COMPILER_WARNING (CWE-563): bash-5.2/jobs.c:2126:23: warning[-Wunused-variable]: unused variable ‘termset’ # 2126 | sigset_t set, oset, termset, chldset, oset_copy; # | ^~~~~~~ # 2124| { # 2125| int async_p, forksleep; # 2126|-> sigset_t set, oset, termset, chldset, oset_copy; # 2127| pid_t pid; # 2128| SigHandler *oterm; Error: COMPILER_WARNING (CWE-563): bash-5.2/jobs.c: scope_hint: In function ‘make_child’ bash-5.2/jobs.c:2126:32: warning[-Wunused-variable]: unused variable ‘chldset’ # 2126 | sigset_t set, oset, termset, chldset, oset_copy; # | ^~~~~~~ # 2124| { # 2125| int async_p, forksleep; # 2126|-> sigset_t set, oset, termset, chldset, oset_copy; # 2127| pid_t pid; # 2128| SigHandler *oterm; Error: COMPILER_WARNING (CWE-457): bash-5.2/jobs.c: scope_hint: In function ‘make_child’ bash-5.2/jobs.c:2186:7: warning[-Wmaybe-uninitialized]: ‘oterm’ may be used uninitialized # 2186 | set_signal_handler (SIGTERM, oterm); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bash-5.2/jobs.c:2128:15: note: ‘oterm’ was declared here # 2128 | SigHandler *oterm; # | ^~~~~ # 2184| if (pid != 0) # 2185| if (interactive_shell) # 2186|-> set_signal_handler (SIGTERM, oterm); # 2187| # 2188| if (pid < 0) Error: CLANG_WARNING: bash-5.2/jobs.c:2186:7: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value # 2184| if (pid != 0) # 2185| if (interactive_shell) # 2186|-> set_signal_handler (SIGTERM, oterm); # 2187| # 2188| if (pid < 0) Error: GCC_ANALYZER_WARNING (CWE-476): bash-5.2/jobs.c:2575:11: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ bash-5.2/jobs.c: scope_hint: In function ‘notify_of_job_status.part.0’ bash-5.2/jobs.c: scope_hint: In function ‘notify_of_job_status.part.0’ # 2573| p = find_last_proc (job, block); # 2574| /* Possible race condition here. */ # 2575|-> return p->pid; # 2576| } # 2577| Error: CLANG_WARNING: bash-5.2/jobs.c:2612:3: warning[deadcode.DeadStores]: Value stored to 'alive' is never read # 2610| } # 2611| # 2612|-> alive = 0; # 2613| do # 2614| { Error: COMPILER_WARNING (CWE-563): bash-5.2/jobs.c: scope_hint: In function ‘wait_for_background_pids’ bash-5.2/jobs.c:2652:20: warning[-Wunused-but-set-variable]: variable ‘check_async’ set but not used # 2652 | int any_stopped, check_async, njobs; # | ^~~~~~~~~~~ # 2650| { # 2651| register int i, r; # 2652|-> int any_stopped, check_async, njobs; # 2653| sigset_t set, oset; # 2654| pid_t pid; Error: CLANG_WARNING: bash-5.2/jobs.c:2656:16: warning[deadcode.DeadStores]: Although the value stored to 'any_stopped' is used in the enclosing expression, the value is never actually read from 'any_stopped' # 2654| pid_t pid; # 2655| # 2656|-> for (njobs = any_stopped = 0, check_async = 1;;) # 2657| { # 2658| BLOCK_CHILD (set, oset); Error: CLANG_WARNING: bash-5.2/jobs.c:2656:33: warning[deadcode.DeadStores]: Although the value stored to 'check_async' is used in the enclosing expression, the value is never actually read from 'check_async' # 2654| pid_t pid; # 2655| # 2656|-> for (njobs = any_stopped = 0, check_async = 1;;) # 2657| { # 2658| BLOCK_CHILD (set, oset); Error: CLANG_WARNING: bash-5.2/jobs.c:2672:8: warning[deadcode.DeadStores]: Value stored to 'any_stopped' is never read # 2670| { # 2671| builtin_warning ("job %d[%d] stopped", i+1, find_last_pid (i, 0)); # 2672|-> any_stopped = 1; # 2673| } # 2674| Error: CLANG_WARNING: bash-5.2/jobs.c:2698:4: warning[deadcode.DeadStores]: Value stored to 'check_async' is never read # 2696| { # 2697| /* If we're mistaken about job state, compensate. */ # 2698|-> check_async = 0; # 2699| mark_all_jobs_as_dead (); # 2700| } Error: CLANG_WARNING: bash-5.2/jobs.c:2763:6: warning[deadcode.DeadStores]: Although the value stored to 'sigint_handler' is used in the enclosing expression, the value is never actually read from 'sigint_handler' # 2761| if (this_shell_builtin && this_shell_builtin == wait_builtin && # 2762| signal_is_trapped (SIGINT) && # 2763|-> ((sigint_handler = trap_to_sighandler (SIGINT)) == trap_handler)) # 2764| { # 2765| trap_handler (SIGINT); /* set pending_traps[SIGINT] */ Error: CLANG_WARNING: bash-5.2/jobs.c:3014:5: warning[deadcode.DeadStores]: Value stored to 'termination_state' is never read # 3012| if (pid == ANY_PID) # 3013| { # 3014|-> termination_state = -1; # 3015| break; # 3016| } Error: CLANG_WARNING: bash-5.2/jobs.c:3445:3: warning[deadcode.DeadStores]: Value stored to 'candidate' is never read # 3443| /* Second choice: Newest stopped job that is older than # 3444| the current job. */ # 3445|-> candidate = NO_JOB; # 3446| if (STOPPED (js.j_current)) # 3447| { Error: CLANG_WARNING: bash-5.2/jobs.c:3446:7: warning[core.NullDereference]: Access to field 'state' results in a dereference of a null pointer # 3444| the current job. */ # 3445| candidate = NO_JOB; # 3446|-> if (STOPPED (js.j_current)) # 3447| { # 3448| candidate = job_last_stopped (js.j_current); Error: COMPILER_WARNING (CWE-563): bash-5.2/jobs.c: scope_hint: In function ‘sigchld_handler’ bash-5.2/jobs.c:3749:7: warning[-Wunused-but-set-variable]: variable ‘n’ set but not used # 3749 | int n, oerrno; # | ^ # 3747| int sig; # 3748| { # 3749|-> int n, oerrno; # 3750| # 3751| oerrno = errno; Error: CLANG_WARNING: bash-5.2/jobs.c:3754:3: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 3752| REINSTALL_SIGCHLD_HANDLER; # 3753| sigchld++; # 3754|-> n = 0; # 3755| if (queue_sigchld == 0) # 3756| n = waitchld (-1, 0); Error: CLANG_WARNING: bash-5.2/jobs.c:3756:5: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 3754| n = 0; # 3755| if (queue_sigchld == 0) # 3756|-> n = waitchld (-1, 0); # 3757| errno = oerrno; # 3758| SIGRETURN (n); Error: CLANG_WARNING: bash-5.2/jobs.c:4090:4: warning[deadcode.DeadStores]: Value stored to 'tstatus' is never read # 4088| old_frozen = jobs_list_frozen; # 4089| jobs_list_frozen = 1; # 4090|-> tstatus = maybe_call_trap_handler (SIGINT); # 4091| jobs_list_frozen = old_frozen; # 4092| } Error: CPPCHECK_WARNING: bash-5.2/lib/glob/glob.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/glob.c:204:27: warning[-Wunused-but-set-variable]: variable ‘nullpat’ set but not used # 204 | int n, r, negate, wild, nullpat, xflags; # | ^~~~~~~ # 202| { # 203| char *pp, *pe, *t, *se; # 204|-> int n, r, negate, wild, nullpat, xflags; # 205| # 206| negate = *pat == '!'; Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:220:49: warning[deadcode.DeadStores]: Although the value stored to 't' is used in the enclosing expression, the value is never actually read from 't' # 218| /* if pe != se we have more of the pattern at the end of the extglob # 219| pattern. Check the easy case first ( */ # 220|-> if (pe == se && *pe == 0 && pe[-1] == ')' && (t = strchr (pp, '|')) == 0) # 221| { # 222| pe[-1] = '\0'; Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:234:3: warning[deadcode.DeadStores]: Value stored to 'nullpat' is never read # 232| pattern can match nothing, so should we check any remaining portion of # 233| the pattern? */ # 234|-> nullpat = pe >= (pat + 2) && pe[-2] == '(' && pe[-1] == ')'; # 235| # 236| /* check every subpattern */ Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/glob/glob.c: scope_hint: In function ‘extglob_skipname’ bash-5.2/lib/glob/glob.c:237:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 237 | while (t = glob_patscan (pp, pe, '|')) # | ^ # 235| # 236| /* check every subpattern */ # 237|-> while (t = glob_patscan (pp, pe, '|')) # 238| { # 239| /* If T == PE and *T == 0 (&& PE[-1] == RPAREN), we have hit the end Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:257:5: warning[core.uninitialized.UndefReturn]: Undefined or garbage value returned to caller # 255| /* glob_patscan might find end of string */ # 256| if (pp == se) # 257|-> return r; # 258| # 259| /* but if it doesn't then we didn't match a leading dot */ Error: COMPILER_WARNING (CWE-457): bash-5.2/lib/glob/glob.c:257:12: warning[-Wmaybe-uninitialized]: ‘r’ may be used uninitialized # 257 | return r; # | ^ bash-5.2/lib/glob/glob.c: scope_hint: In function ‘skipname.isra.0’ bash-5.2/lib/glob/glob.c:204:10: note: ‘r’ was declared here # 204 | int n, r, negate, wild, nullpat, xflags; # | ^ # 255| /* glob_patscan might find end of string */ # 256| if (pp == se) # 257|-> return r; # 258| # 259| /* but if it doesn't then we didn't match a leading dot */ Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/glob.c: scope_hint: In function ‘skipname’ bash-5.2/lib/glob/glob.c:275:7: warning[-Wunused-variable]: unused variable ‘i’ # 275 | int i; # | ^ # 273| int flags; # 274| { # 275|-> int i; # 276| # 277| #if EXTENDED_GLOB Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/glob.c: scope_hint: In function ‘wskipname’ bash-5.2/lib/glob/glob.c:317:7: warning[-Wunused-variable]: unused variable ‘i’ # 317 | int i; # | ^ # 315| int flags; # 316| { # 317|-> int i; # 318| # 319| if (glob_always_skip_dot_and_dotdot && WDOT_OR_DOTDOT (dname)) Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/glob.c:355:24: warning[-Wunused-but-set-variable]: variable ‘nullpat’ set but not used # 355 | int r, negate, wild, nullpat, xflags; # | ^~~~~~~ # 353| #if EXTENDED_GLOB # 354| wchar_t *pp, *pe, *t, *se, n; # 355|-> int r, negate, wild, nullpat, xflags; # 356| # 357| negate = *pat == L'!'; Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:371:54: warning[deadcode.DeadStores]: Although the value stored to 't' is used in the enclosing expression, the value is never actually read from 't' # 369| /* if pe != se we have more of the pattern at the end of the extglob # 370| pattern. Check the easy case first ( */ # 371|-> if (pe == se && *pe == L'\0' && pe[-1] == L')' && (t = wcschr (pp, L'|')) == 0) # 372| { # 373| pe[-1] = L'\0'; Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:382:3: warning[deadcode.DeadStores]: Value stored to 'nullpat' is never read # 380| pattern can match nothing, so should we check any remaining portion of # 381| the pattern? */ # 382|-> nullpat = pe >= (pat + 2) && pe[-2] == L'(' && pe[-1] == L')'; # 383| # 384| /* check every subpattern */ Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/glob/glob.c: scope_hint: In function ‘wextglob_skipname’ bash-5.2/lib/glob/glob.c:385:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 385 | while (t = glob_patscan_wc (pp, pe, '|')) # | ^ # 383| # 384| /* check every subpattern */ # 385|-> while (t = glob_patscan_wc (pp, pe, '|')) # 386| { # 387| n = t[-1]; /* ( */ Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:403:5: warning[core.uninitialized.UndefReturn]: Undefined or garbage value returned to caller # 401| /* glob_patscan_wc might find end of string */ # 402| if (pp == se) # 403|-> return r; # 404| # 405| /* but if it doesn't then we didn't match a leading dot */ Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:429:3: warning[deadcode.DeadStores]: Value stored to 'ext' is never read # 427| return (skipname (pat, dname, flags)); # 428| # 429|-> ext = 0; # 430| #if EXTENDED_GLOB # 431| ext = extglob_pattern_p (pat); Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:440:3: warning[deadcode.DeadStores]: Value stored to 'ret' is never read # 438| dn_n = xdupmbstowcs (&dn_wc, NULL, dname); # 439| # 440|-> ret = 0; # 441| if (pat_n != (size_t)-1 && dn_n !=(size_t)-1) # 442| ret = ext ? wextglob_skipname (pat_wc, dn_wc, flags) : wskipname (pat_wc, dn_wc, flags); Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/glob.c:503:7: warning[-Wunused-variable]: unused variable ‘i’ # 503 | int i, j; # | ^ # 501| size_t len, n; # 502| wchar_t *wpathname; # 503|-> int i, j; # 504| wchar_t *orig_wpathname; # 505| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/glob.c: scope_hint: In function ‘wdequote_pathname’ bash-5.2/lib/glob/glob.c:503:10: warning[-Wunused-variable]: unused variable ‘j’ # 503 | int i, j; # | ^ # 501| size_t len, n; # 502| wchar_t *wpathname; # 503|-> int i, j; # 504| wchar_t *orig_wpathname; # 505| Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:532:7: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 530| wpathname = orig_wpathname; # 531| memset (&ps, '\0', sizeof(mbstate_t)); # 532|-> n = xwcsrtombs (pathname, (const wchar_t **)&wpathname, len, &ps); # 533| } # 534| pathname[len] = '\0'; Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/glob.c: scope_hint: In function ‘finddirs’ bash-5.2/lib/glob/glob.c:606:14: warning[-Wunused-variable]: unused variable ‘n’ # 606 | char **r, *n; # | ^ # 604| int *np; # 605| { # 606|-> char **r, *n; # 607| int ndirs; # 608| struct globval *ret, *e, *g; Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:739:3: warning[deadcode.DeadStores]: Value stored to 'hasglob' is never read # 737| a filename `DIR/PAT'. If there is, and we can access it, just make the # 738| vector to return and bail immediately. */ # 739|-> hasglob = 0; # 740| if (skip == 0 && ((hasglob = glob_pattern_p (pat)) == 0 || hasglob == 2)) # 741| { Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:876:18: warning[core.UndefinedBinaryOperatorResult]: The left operand of '==' is a garbage value # 874| if (flags & GX_ALLDIRS) # 875| { # 876|-> if (isdir == 0) # 877| { # 878| dirlist = finddirs (pat, subdir, (flags & ~GX_ADDCURDIR), &e, &ndirs); Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:921:6: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 919| } # 920| else if (flags & GX_MATCHDIRS) # 921|-> free (subdir); # 922| # 923| convfn = fnx_fromfs (dp->d_name, D_NAMLEN (dp)); Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:1022:10: warning[unix.Malloc]: Potential leak of memory pointed to by 'lastlink' # 1020| free (lastlink->name); # 1021| lastlink = lastlink->next; # 1022|-> FREE (tmplink); # 1023| } # 1024| Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:1054:11: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmplink' # 1052| } # 1053| # 1054|-> return (name_vector); # 1055| } # 1056| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/glob.c: scope_hint: In function ‘glob_filename’ bash-5.2/lib/glob/glob.c:1339:19: warning[-Wunused-variable]: unused variable ‘dlen’ # 1339 | int dlen; # | ^~~~ # 1337| if (all_starstar && (dflags & GX_NULLDIR) == 0) # 1338| { # 1339|-> int dlen; # 1340| # 1341| /* If we have a directory name that is not null (GX_NULLDIR above) Error: CPPCHECK_WARNING (CWE-758): bash-5.2/lib/glob/glob.c:1425: warning[objectIndex]: The address of variable 'glob_error_return' might be accessed at non-zero index. # 1423| array = glob_dir_to_array (directories[i], temp_results, flags); # 1424| l = 0; # 1425|-> while (array[l] != NULL) # 1426| ++l; # 1427| Error: CPPCHECK_WARNING (CWE-758): bash-5.2/lib/glob/glob.c:1432: warning[objectIndex]: The address of variable 'glob_error_return' might be accessed at non-zero index. # 1430| if (new_result == NULL) # 1431| { # 1432|-> for (l = 0; array[l]; ++l) # 1433| free (array[l]); # 1434| free ((char *)array); Error: CPPCHECK_WARNING (CWE-758): bash-5.2/lib/glob/glob.c:1433: warning[objectIndex]: The address of variable 'glob_error_return' might be accessed at non-zero index. # 1431| { # 1432| for (l = 0; array[l]; ++l) # 1433|-> free (array[l]); # 1434| free ((char *)array); # 1435| goto memory_error; Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:1470:8: warning[unix.Malloc]: Potential leak of memory pointed to by 'result' # 1468| if (result == NULL) # 1469| { # 1470|-> if (free_dirname) # 1471| free (directory_name); # 1472| return (NULL); Error: CLANG_WARNING: bash-5.2/lib/glob/glob.c:144: included_from: Included from here. bash-5.2/lib/glob/glob_loop.c:32:11: warning[deadcode.DeadStores]: Although the value stored to 'bsquote' is used in the enclosing expression, the value is never actually read from 'bsquote' # 30| # 31| p = pattern; # 32|-> bopen = bsquote = 0; # 33| # 34| while ((c = *p++) != L('\0')) Error: CLANG_WARNING: bash-5.2/lib/glob/glob_loop.c:66:6: warning[deadcode.DeadStores]: Value stored to 'bsquote' is never read # 64| { # 65| p++; # 66|-> bsquote = 1; # 67| continue; # 68| } Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/gm_loop.c:79:25: warning[-Wunused-variable]: unused variable ‘t’ # 79 | int matlen, bracklen, t, in_cclass, in_collsym, in_equiv; # | ^ # 77| { # 78| CHAR c; # 79|-> int matlen, bracklen, t, in_cclass, in_collsym, in_equiv; # 80| # 81| if (*pat == 0) Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/glob/gmisc.c:57: included_from: Included from here. bash-5.2/lib/glob/gm_loop.c: scope_hint: In function ‘umatchlen’ bash-5.2/lib/glob/gm_loop.c:85:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 85 | while (c = *pat++) # | ^ # 83| # 84| matlen = in_cclass = in_collsym = in_equiv = 0; # 85|-> while (c = *pat++) # 86| { # 87| switch (c) Error: CLANG_WARNING: bash-5.2/lib/glob/gmisc.c:57: included_from: Included from here. bash-5.2/lib/glob/gm_loop.c:103:14: warning[deadcode.DeadStores]: Although the value stored to 'matlen' is used in the enclosing expression, the value is never actually read from 'matlen' # 101| case L('?'): # 102| if (*pat == LPAREN) # 103|-> return (matlen = -1); /* XXX for now */ # 104| else # 105| matlen++; Error: CLANG_WARNING: bash-5.2/lib/glob/gm_loop.c:108:12: warning[deadcode.DeadStores]: Although the value stored to 'matlen' is used in the enclosing expression, the value is never actually read from 'matlen' # 106| break; # 107| case L('*'): # 108|-> return (matlen = -1); # 109| case L('+'): # 110| case L('!'): Error: CLANG_WARNING: bash-5.2/lib/glob/gm_loop.c:113:14: warning[deadcode.DeadStores]: Although the value stored to 'matlen' is used in the enclosing expression, the value is never actually read from 'matlen' # 111| case L('@'): # 112| if (*pat == LPAREN) # 113|-> return (matlen = -1); /* XXX for now */ # 114| else # 115| matlen++; Error: CPPCHECK_WARNING: bash-5.2/lib/glob/gmisc.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/glob/smatch.c:340: included_from: Included from here. bash-5.2/lib/glob/sm_loop.c: scope_hint: In function ‘brackmatch’ bash-5.2/lib/glob/sm_loop.c:434:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 434 | if (not = (*p == L('!') || *p == L('^'))) # | ^~~ # 432| expression starting with an unquoted circumflex character produces # 433| unspecified results. This implementation treats the two identically. */ # 434|-> if (not = (*p == L('!') || *p == L('^'))) # 435| ++p; # 436| Error: CLANG_WARNING: bash-5.2/lib/glob/smatch.c:340: included_from: Included from here. bash-5.2/lib/glob/sm_loop.c:442:16: warning[deadcode.DeadStores]: Although the value stored to 'cend' is used in the enclosing expression, the value is never actually read from 'cend' # 440| /* Initialize cstart and cend in case `-' is the last # 441| character of the pattern. */ # 442|-> cstart = cend = c; # 443| forcecoll = 0; # 444| Error: CLANG_WARNING: bash-5.2/lib/glob/sm_loop.c:554:13: warning[deadcode.DeadStores]: Although the value stored to 'cend' is used in the enclosing expression, the value is never actually read from 'cend' # 552| if (*p == '\0') # 553| return (CHAR *)0; # 554|-> cstart = cend = *p++; # 555| } # 556| Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/glob/sm_loop.c: scope_hint: In function ‘glob_patscan’ bash-5.2/lib/glob/sm_loop.c:713:20: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 713 | for (s = string; c = *s; s++) # | ^ # 711| return (NULL); # 712| # 713|-> for (s = string; c = *s; s++) # 714| { # 715| if (s >= end) Error: CLANG_WARNING: bash-5.2/lib/glob/sm_loop.c:919:4: warning[deadcode.DeadStores]: Value stored to 'm1' is never read # 917| for (srest = s; srest <= se; srest++) # 918| { # 919|-> m1 = 0; # 920| for (psub = p + 1; ; psub = pnext) # 921| { Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/glob/sm_loop.c: scope_hint: In function ‘extmatch’ bash-5.2/lib/glob/sm_loop.c:924:19: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 924 | if (m1 = (GMATCH (s, srest, psub, pnext - 1, NULL, flags) == 0)) # | ^~ # 922| pnext = PATSCAN (psub, pe, L('|')); # 923| /* If one of the patterns matches, just bail immediately. */ # 924|-> if (m1 = (GMATCH (s, srest, psub, pnext - 1, NULL, flags) == 0)) # 925| break; # 926| if (pnext == prest) Error: CPPCHECK_WARNING: bash-5.2/lib/glob/smatch.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/smatch.c: scope_hint: In function ‘charcmp’ bash-5.2/lib/glob/smatch.c:108:7: warning[-Wunused-variable]: unused variable ‘ret’ # 108 | int ret; # | ^~~ # 106| static char s1[2] = { ' ', '\0' }; # 107| static char s2[2] = { ' ', '\0' }; # 108|-> int ret; # 109| # 110| /* Eight bits only. Period. */ Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/smatch.c: scope_hint: In function ‘charcmp_wc’ bash-5.2/lib/glob/smatch.c:396:7: warning[-Wunused-variable]: unused variable ‘r’ # 396 | int r; # | ^ # 394| static wchar_t s1[2] = { L' ', L'\0' }; # 395| static wchar_t s2[2] = { L' ', L'\0' }; # 396|-> int r; # 397| # 398| if (c1 == c2) Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/glob/smatch.c: scope_hint: In function ‘posix_cclass_only’ bash-5.2/lib/glob/smatch.c:535:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 535 | while (p = strchr (p, '[')) # | ^ # 533| # 534| p = pattern; # 535|-> while (p = strchr (p, '[')) # 536| { # 537| if (p[1] != ':') Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/smatch.c:610:10: warning[-Wunused-variable]: unused variable ‘plen’ # 610 | size_t plen, slen, mplen, mslen; # | ^~~~ # 608| size_t n; # 609| wchar_t *wpattern, *wstring; # 610|-> size_t plen, slen, mplen, mslen; # 611| # 612| if (MB_CUR_MAX == 1) Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/smatch.c:610:16: warning[-Wunused-variable]: unused variable ‘slen’ # 610 | size_t plen, slen, mplen, mslen; # | ^~~~ # 608| size_t n; # 609| wchar_t *wpattern, *wstring; # 610|-> size_t plen, slen, mplen, mslen; # 611| # 612| if (MB_CUR_MAX == 1) Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/smatch.c:610:22: warning[-Wunused-variable]: unused variable ‘mplen’ # 610 | size_t plen, slen, mplen, mslen; # | ^~~~~ # 608| size_t n; # 609| wchar_t *wpattern, *wstring; # 610|-> size_t plen, slen, mplen, mslen; # 611| # 612| if (MB_CUR_MAX == 1) Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/smatch.c: scope_hint: In function ‘xstrmatch’ bash-5.2/lib/glob/smatch.c:610:29: warning[-Wunused-variable]: unused variable ‘mslen’ # 610 | size_t plen, slen, mplen, mslen; # | ^~~~~ # 608| size_t n; # 609| wchar_t *wpattern, *wstring; # 610|-> size_t plen, slen, mplen, mslen; # 611| # 612| if (MB_CUR_MAX == 1) Error: CPPCHECK_WARNING: bash-5.2/lib/glob/xmbsrtowcs.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING (CWE-456): bash-5.2/lib/glob/xmbsrtowcs.c:94: error[uninitdata]: Memory is allocated but not initialized: wsbuf # 92| psbuf = *ps; # 93| # 94|-> wclength = mbsrtowcs (wsbuf, &mbs, n, &psbuf); # 95| # 96| if (wsbuf) Error: GCC_ANALYZER_WARNING (CWE-476): bash-5.2/lib/glob/xmbsrtowcs.c: scope_hint: In function ‘xdupmbstowcs2’ bash-5.2/lib/glob/xmbsrtowcs.c:226:24: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘wsbuf’ # 224| if (n == 0 && p == 0) # 225| { # 226|-> wsbuf[wcnum] = L'\0'; # 227| break; # 228| } Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/glob/xmbsrtowcs.c:429:13: warning[-Wunused-variable]: unused variable ‘prev_state’ # 429 | mbstate_t prev_state; # | ^~~~~~~~~~ # 427| char buf[64], *destptr, *tmp_dest; # 428| unsigned char uc; # 429|-> mbstate_t prev_state; # 430| # 431| cur_max = MB_CUR_MAX; Error: COMPILER_WARNING (CWE-1164): bash-5.2/lib/glob/xmbsrtowcs.c: scope_hint: In function ‘xwcsrtombs’ bash-5.2/lib/glob/xmbsrtowcs.c:456:1: warning[-Wunused-label]: label ‘handle_byte’ defined but not used # 456 | handle_byte: # | ^~~~~~~~~~~ # 454| treat invalid wide character sequences as bytes. This is # 455| intended to be symmetric with xdupmbstowcs2. */ # 456|-> handle_byte: # 457| destptr = tmp_dest; /* in case wcrtomb modified it */ # 458| uc = wc; Error: CPPCHECK_WARNING: bash-5.2/lib/readline/bind.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/readline/bind.c: scope_hint: In function ‘_rl_skip_to_delim’ bash-5.2/lib/readline/bind.c:1581:29: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 1581 | for (i = start,passc = 0; c = string[i]; i++) # | ^ # 1579| int i, c, passc; # 1580| # 1581|-> for (i = start,passc = 0; c = string[i]; i++) # 1582| { # 1583| if (passc) Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/bind.c: scope_hint: In function ‘rl_parse_and_bind’ bash-5.2/lib/readline/bind.c:1675:11: warning[-Wunused-variable]: unused variable ‘s’ # 1675 | int s; # | ^ # 1673| { # 1674| char *var, *value, *e; # 1675|-> int s; # 1676| # 1677| var = string + i; Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/readline/bind.c: scope_hint: In function ‘rl_function_dumper’ bash-5.2/lib/readline/bind.c:2805:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 2805 | for (i = 0; name = names[i]; i++) # | ^~~~ # 2803| fprintf (rl_outstream, "\n"); # 2804| # 2805|-> for (i = 0; name = names[i]; i++) # 2806| { # 2807| rl_command_func_t *function; Error: CPPCHECK_WARNING: bash-5.2/lib/readline/callback.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/lib/readline/callback.c:139:3: warning[deadcode.DeadStores]: Value stored to 'eof' is never read # 137| } # 138| # 139|-> eof = 0; # 140| # 141| memcpy ((void *)olevel, (void *)_rl_top_level, sizeof (procenv_t)); Error: CLANG_WARNING: bash-5.2/lib/readline/callback.c:182:4: warning[deadcode.DeadStores]: Value stored to 'eof' is never read # 180| else if (RL_ISSTATE (RL_STATE_NSEARCH)) # 181| { # 182|-> eof = _rl_nsearch_callback (_rl_nscxt); # 183| # 184| CALLBACK_READ_RETURN (); Error: CLANG_WARNING: bash-5.2/lib/readline/callback.c:219:4: warning[deadcode.DeadStores]: Value stored to 'eof' is never read # 217| else if (RL_ISSTATE (RL_STATE_VIMOTION)) # 218| { # 219|-> eof = _rl_vi_domove_callback (_rl_vimvcxt); # 220| /* Should handle everything, including cleanup, numeric arguments, # 221| and turning off RL_STATE_VIMOTION */ Error: CPPCHECK_WARNING: bash-5.2/lib/readline/colors.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/lib/readline/complete.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-457): bash-5.2/lib/readline/complete.c: scope_hint: In function ‘print_filename’ bash-5.2/lib/readline/complete.c:1043:22: warning[-Wmaybe-uninitialized]: ‘printed_len’ may be used uninitialized # 1043 | printed_len++; # | ~~~~~~~~~~~^~ bash-5.2/lib/readline/complete.c:936:7: note: ‘printed_len’ was declared here # 936 | int printed_len, extension_char, slen, tlen; # | ^~~~~~~~~~~ # 1041| { # 1042| putc (extension_char, rl_outstream); # 1043|-> printed_len++; # 1044| } # 1045| } Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/readline/complete.c: scope_hint: In function ‘_rl_find_completion_word’ bash-5.2/lib/readline/complete.c:1151:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 1151 | while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY)) # | ^~~~~~~~ # 1149| completion, so use the word break characters to find the # 1150| substring on which to complete. */ # 1151|-> while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY)) # 1152| { # 1153| scan = rl_line_buffer[rl_point]; Error: CPPCHECK_WARNING (CWE-562): bash-5.2/lib/readline/complete.c:1280: error[autoVariables]: Address of local auto-variable assigned to a function parameter. # 1278| { # 1279| xfree (matches[i]); # 1280|-> matches[i] = (char *)&dead_slot; # 1281| } # 1282| else Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/complete.c: scope_hint: In function ‘compute_lcd_of_matches’ bash-5.2/lib/readline/complete.c:1323:7: warning[-Wunused-variable]: unused variable ‘v’ # 1323 | int v; # | ^ # 1321| char *dtext; /* dequoted TEXT, if needed */ # 1322| #if defined (HANDLE_MULTIBYTE) # 1323|-> int v; # 1324| size_t v1, v2; # 1325| mbstate_t ps1, ps2; Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/readline/complete.c: scope_hint: In function ‘rl_completion_matches’ bash-5.2/lib/readline/complete.c:2219:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 2219 | while (string = (*entry_function) (text, matches)) # | ^~~~~~ # 2217| match_list[1] = (char *)NULL; # 2218| # 2219|-> while (string = (*entry_function) (text, matches)) # 2220| { # 2221| if (RL_SIG_RECEIVED ()) Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/readline/complete.c: scope_hint: In function ‘rl_username_completion_function’ bash-5.2/lib/readline/complete.c:2291:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 2291 | while (entry = getpwent ()) # | ^~~~~ # 2289| # 2290| #if defined (HAVE_GETPWENT) # 2291|-> while (entry = getpwent ()) # 2292| { # 2293| /* Null usernames should result in all users as possible completions. */ Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/complete.c: scope_hint: In function ‘rl_menu_complete’ bash-5.2/lib/readline/complete.c:2828:25: warning[-Wunused-variable]: unused variable ‘cstate’ # 2828 | static int delimiter, cstate; # | ^~~~~~ # 2826| static int orig_start, orig_end; # 2827| static char quote_char; # 2828|-> static int delimiter, cstate; # 2829| # 2830| /* The first time through, we generate the list of matches and set things Error: CPPCHECK_WARNING: bash-5.2/lib/readline/display.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/display.c:767:29: warning[-Wunused-variable]: unused variable ‘n0’ # 767 | int newlines, lpos, temp, n0, num, prompt_lines_estimate; # | ^~ # 765| int in, out, c, linenum, cursor_linenum; # 766| int inv_botlin, lb_botlin, lb_linenum, o_cpos; # 767|-> int newlines, lpos, temp, n0, num, prompt_lines_estimate; # 768| char *prompt_this_line; # 769| char cur_face; Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/display.c:767:33: warning[-Wunused-but-set-variable]: variable ‘num’ set but not used # 767 | int newlines, lpos, temp, n0, num, prompt_lines_estimate; # | ^~~ # 765| int in, out, c, linenum, cursor_linenum; # 766| int inv_botlin, lb_botlin, lb_linenum, o_cpos; # 767|-> int newlines, lpos, temp, n0, num, prompt_lines_estimate; # 768| char *prompt_this_line; # 769| char cur_face; Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/display.c: scope_hint: In function ‘rl_redisplay’ bash-5.2/lib/readline/display.c:767:38: warning[-Wunused-but-set-variable]: variable ‘prompt_lines_estimate’ set but not used # 767 | int newlines, lpos, temp, n0, num, prompt_lines_estimate; # | ^~~~~~~~~~~~~~~~~~~~~ # 765| int in, out, c, linenum, cursor_linenum; # 766| int inv_botlin, lb_botlin, lb_linenum, o_cpos; # 767|-> int newlines, lpos, temp, n0, num, prompt_lines_estimate; # 768| char *prompt_this_line; # 769| char cur_face; Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:824:9: warning[deadcode.DeadStores]: Although the value stored to 'inv_botlin' is used in the enclosing expression, the value is never actually read from 'inv_botlin' # 822| prompt_multibyte_chars = prompt_visible_length - prompt_physical_chars; # 823| # 824|-> out = inv_botlin = 0; # 825| # 826| /* Mark the line as modified or not. We only do this for history Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:960:3: warning[deadcode.DeadStores]: Value stored to 'num' is never read # 958| #if defined (HANDLE_MULTIBYTE) # 959| memset (line_state_invisible->wrapped_line, 0, line_state_invisible->wbsize * sizeof (int)); # 960|-> num = 0; # 961| #endif # 962| Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:969:3: warning[deadcode.DeadStores]: Value stored to 'prompt_lines_estimate' is never read # 967| # 968| /* This is zero-based, used to set the newlines */ # 969|-> prompt_lines_estimate = lpos / _rl_screenwidth; # 970| # 971| /* what if lpos is already >= _rl_screenwidth before we start drawing the Error: COMPILER_WARNING (CWE-457): bash-5.2/lib/readline/display.c: scope_hint: In function ‘rl_redisplay’ bash-5.2/lib/readline/display.c:1147:42: warning[-Wmaybe-uninitialized]: ‘wc_width’ may be used uninitialized # 1147 | if (_rl_screenwidth < lpos + wc_width) # | ~~~~~^~~~~~~~~~ bash-5.2/lib/readline/display.c:775:7: note: ‘wc_width’ was declared here # 775 | int wc_width; # | ^~~~~~~~ # 1145| _rl_wrapped_multicolumn = 0; # 1146| # 1147|-> if (_rl_screenwidth < lpos + wc_width) # 1148| for (i = lpos; i < _rl_screenwidth; i++) # 1149| { Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:1206:16: warning[deadcode.DeadStores]: Although the value stored to 'lb_botlin' is used in the enclosing expression, the value is never actually read from 'lb_botlin' # 1204| _rl_quick_redisplay = 0; # 1205| # 1206|-> inv_botlin = lb_botlin = _rl_inv_botlin = newlines; # 1207| CHECK_INV_LBREAKS (); # 1208| inv_lbreaks[newlines+1] = out; Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/display.c:1655:39: warning[-Wunused-variable]: unused variable ‘twidth’ # 1655 | int temp, lendiff, wsatend, od, nd, twidth, o_cpos; # | ^~~~~~ # 1653| char *ofd, *ols, *oe, *nfd, *nls, *ne; # 1654| char *ofdf, *nfdf, *olsf, *nlsf; # 1655|-> int temp, lendiff, wsatend, od, nd, twidth, o_cpos; # 1656| int current_invis_chars; # 1657| int col_lendiff, col_temp; Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/display.c:1786:19: warning[-Wunused-variable]: unused variable ‘count’ # 1786 | int count, i, j; # | ^~~~~ # 1784| if (newwidth > 0) # 1785| { # 1786|-> int count, i, j; # 1787| char *optr; # 1788| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/display.c: scope_hint: In function ‘update_line’ bash-5.2/lib/readline/display.c:1787:21: warning[-Wunused-variable]: unused variable ‘optr’ # 1787 | char *optr; # | ^~~~ # 1785| { # 1786| int count, i, j; # 1787|-> char *optr; # 1788| # 1789| puts_face (new, new_face, newbytes); Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:1804:5: warning[deadcode.DeadStores]: Value stored to 'ofdf' is never read # 1802| nd = newbytes; # 1803| nfd = new + nd; # 1804|-> ofdf = old_face + oldbytes; # 1805| nfdf = new_face + newbytes; # 1806| Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:1868:7: warning[deadcode.DeadStores]: Value stored to 'ofdf' is never read # 1866| nfdf = new_face; # 1867| ofd = old; # 1868|-> ofdf = old_face; # 1869| for (od = 0, oe = ofd; od < omax && *oe; oe++, od++); # 1870| for (nd = 0, ne = nfd; nd < nmax && *ne; ne++, nd++); Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:1871:7: warning[deadcode.DeadStores]: Value stored to 'od' is never read # 1869| for (od = 0, oe = ofd; od < omax && *oe; oe++, od++); # 1870| for (nd = 0, ne = nfd; nd < nmax && *ne; ne++, nd++); # 1871|-> od = nd = 0; # 1872| _rl_move_cursor_relative (0, old, old_face); # 1873| Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:1913:4: warning[deadcode.DeadStores]: Value stored to 'new_offset' is never read # 1911| if (memcmp (old, new, temp) == 0 && memcmp (old_face, new_face, temp) == 0) # 1912| { # 1913|-> new_offset = old_offset = temp; /* adding at the end */ # 1914| ofd = old + temp; # 1915| ofdf = old_face + temp; Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:1913:17: warning[deadcode.DeadStores]: Although the value stored to 'old_offset' is used in the enclosing expression, the value is never actually read from 'old_offset' # 1911| if (memcmp (old, new, temp) == 0 && memcmp (old_face, new_face, temp) == 0) # 1912| { # 1913|-> new_offset = old_offset = temp; /* adding at the end */ # 1914| ofd = old + temp; # 1915| ofdf = old_face + temp; Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:1915:4: warning[deadcode.DeadStores]: Value stored to 'ofdf' is never read # 1913| new_offset = old_offset = temp; /* adding at the end */ # 1914| ofd = old + temp; # 1915|-> ofdf = old_face + temp; # 1916| nfd = new + temp; # 1917| nfdf = new_face + temp; Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:1927:8: warning[deadcode.DeadStores]: Value stored to 'old_offset' is never read # 1925| if (omax == nmax && memcmp (new, old, omax) == 0 && memcmp (new_face, old_face, omax) == 0) # 1926| { # 1927|-> old_offset = omax; # 1928| new_offset = nmax; # 1929| ofd = old + omax; Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:1928:8: warning[deadcode.DeadStores]: Value stored to 'new_offset' is never read # 1926| { # 1927| old_offset = omax; # 1928|-> new_offset = nmax; # 1929| ofd = old + omax; # 1930| ofdf = old_face + omax; Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:1930:8: warning[deadcode.DeadStores]: Value stored to 'ofdf' is never read # 1928| new_offset = nmax; # 1929| ofd = old + omax; # 1930|-> ofdf = old_face + omax; # 1931| nfd = new + nmax; # 1932| nfdf = new_face + nmax; Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:1989:4: warning[deadcode.DeadStores]: Value stored to 'ofdf' is never read # 1987| new_offset = _rl_find_prev_mbchar (new, nfd - new, MB_FIND_ANY); # 1988| ofd = old + old_offset; /* equal by definition */ # 1989|-> ofdf = old_face + old_offset; # 1990| nfd = new + new_offset; # 1991| nfdf = new_face + new_offset; Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:2047:7: warning[deadcode.DeadStores]: Value stored to 'olsf' is never read # 2045| { # 2046| ols = oe; # 2047|-> olsf = old_face + (ols - old); # 2048| nls = ne; # 2049| nlsf = new_face + (nls - new); Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:2049:7: warning[deadcode.DeadStores]: Value stored to 'nlsf' is never read # 2047| olsf = old_face + (ols - old); # 2048| nls = ne; # 2049|-> nlsf = new_face + (nls - new); # 2050| } # 2051| #if defined (HANDLE_MULTIBYTE) Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:2074:7: warning[deadcode.DeadStores]: Value stored to 'olsf' is never read # 2072| nls++; # 2073| } # 2074|-> olsf = old_face + (ols - old); # 2075| nlsf = new_face + (nls - new); # 2076| } Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:2075:7: warning[deadcode.DeadStores]: Value stored to 'nlsf' is never read # 2073| } # 2074| olsf = old_face + (ols - old); # 2075|-> nlsf = new_face + (nls - new); # 2076| } # 2077| Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:2287:4: warning[deadcode.DeadStores]: Value stored to 'nlsf' is never read # 2285| lendiff = (nls - nfd) - (ols - ofd); # 2286| # 2287|-> nlsf = new_face + (nls - new); # 2288| olsf = old_face + (ols - old); # 2289| } Error: CLANG_WARNING: bash-5.2/lib/readline/display.c:2288:4: warning[deadcode.DeadStores]: Value stored to 'olsf' is never read # 2286| # 2287| nlsf = new_face + (nls - new); # 2288|-> olsf = old_face + (ols - old); # 2289| } # 2290| else Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/display.c: scope_hint: In function ‘rl_forced_update_display’ bash-5.2/lib/readline/display.c:2683:18: warning[-Wunused-variable]: unused variable ‘temp’ # 2683 | register char *temp; # | ^~~~ # 2681| rl_forced_update_display (void) # 2682| { # 2683|-> register char *temp; # 2684| # 2685| if (visible_line) Error: COMPILER_WARNING (CWE-1164): bash-5.2/lib/readline/display.c: scope_hint: At top level bash-5.2/lib/readline/display.c:3236:1: warning[-Wunused-function]: ‘insert_some_chars’ defined but not used # 3236 | insert_some_chars (char *string, int count, int col) # | ^~~~~~~~~~~~~~~~~ # 3234| /* Insert COUNT characters from STRING to the output stream at column COL. */ # 3235| static void # 3236|-> insert_some_chars (char *string, int count, int col) # 3237| { # 3238| open_some_spaces (col); Error: GCC_ANALYZER_WARNING (CWE-688): bash-5.2/lib/readline/funmap.c: scope_hint: In function ‘rl_funmap_names’ bash-5.2/lib/readline/funmap.c:271:3: warning[-Wanalyzer-null-argument]: use of NULL ‘result’ where non-null expected bash-5.2/lib/readline/funmap.c:33: included_from: Included from here. /usr/include/stdlib.h:970:13: note: argument 1 of ‘qsort’ must be non-null # 269| } # 270| # 271|-> qsort (result, result_index, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare); # 272| return (result); # 273| } Error: CLANG_WARNING: bash-5.2/lib/readline/funmap.c:271:3: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 269| } # 270| # 271|-> qsort (result, result_index, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare); # 272| return (result); # 273| } Error: CPPCHECK_WARNING: bash-5.2/lib/readline/histexpand.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/readline/histexpand.c: scope_hint: In function ‘get_history_event’ bash-5.2/lib/readline/histexpand.c:213:25: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 213 | for (local_index = i; c = string[i]; i++) # | ^ # 211| # 212| /* Only a closing `?' or a newline delimit a substring search string. */ # 213|-> for (local_index = i; c = string[i]; i++) # 214| { # 215| #if defined (HANDLE_MULTIBYTE) Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/histexpand.c: scope_hint: In function ‘history_expand_internal’ bash-5.2/lib/readline/histexpand.c:682:48: warning[-Wunused-but-set-variable]: variable ‘ws’ set but not used # 682 | int delimiter, failed, si, l_temp, ws, we; # | ^~ # 680| { # 681| char *new_event; # 682|-> int delimiter, failed, si, l_temp, ws, we; # 683| # 684| if (c == 's') Error: CLANG_WARNING: bash-5.2/lib/readline/histexpand.c:781:7: warning[deadcode.DeadStores]: Value stored to 'ws' is never read # 779| for (; temp[si] && fielddelim (temp[si]); si++) # 780| ; # 781|-> ws = si; # 782| we = history_tokenize_word (temp, si); # 783| } Error: CLANG_WARNING: bash-5.2/lib/readline/histexpand.c:983:4: warning[deadcode.DeadStores]: Value stored to 'squote' is never read # 981| { # 982| hist_string_extract_single_quoted (string, &i, 0); # 983|-> squote = 0; # 984| if (string[i]) # 985| i++; Error: CLANG_WARNING: bash-5.2/lib/readline/histexpand.c:1314:3: warning[deadcode.DeadStores]: Value stored to 'first' is never read # 1312| # 1313| /* The range of words to return doesn't exist yet. */ # 1314|-> first = last = 0; # 1315| result = (char *)NULL; # 1316| Error: CLANG_WARNING: bash-5.2/lib/readline/histexpand.c:1314:11: warning[deadcode.DeadStores]: Although the value stored to 'last' is used in the enclosing expression, the value is never actually read from 'last' # 1312| # 1313| /* The range of words to return doesn't exist yet. */ # 1314|-> first = last = 0; # 1315| result = (char *)NULL; # 1316| Error: GCC_ANALYZER_WARNING (CWE-688): bash-5.2/lib/readline/histexpand.c: scope_hint: In function ‘history_arg_extract’ bash-5.2/lib/readline/histexpand.c:1452:17: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected bash-5.2/lib/readline/histexpand.c: scope_hint: In function ‘history_arg_extract’ bash-5.2/lib/readline/histexpand.c:46: included_from: Included from here. bash-5.2/lib/readline/histexpand.c:1484:7: note: in expansion of macro ‘member’ bash-5.2/lib/readline/histexpand.c:1484:7: note: in expansion of macro ‘member’ bash-5.2/lib/readline/histexpand.c: scope_hint: In function ‘history_arg_extract’ <built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null # 1450| { # 1451| for (size = 0, i = first; i < last; i++) # 1452|-> size += strlen (list[i]) + 1; # 1453| result = (char *)xmalloc (size + 1); # 1454| result[0] = '\0'; Error: CPPCHECK_WARNING: bash-5.2/lib/readline/histfile.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-1164): bash-5.2/lib/readline/histfile.c:187:1: warning[-Wunused-function]: ‘history_backupfile’ defined but not used # 187 | history_backupfile (const char *filename) # | ^~~~~~~~~~~~~~~~~~ # 185| # 186| static char * # 187|-> history_backupfile (const char *filename) # 188| { # 189| const char *fn; Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/histfile.c: scope_hint: In function ‘history_backupfile’ bash-5.2/lib/readline/histfile.c:193:15: warning[-Wunused-variable]: unused variable ‘fs’ # 193 | struct stat fs; # | ^~ # 191| size_t len; # 192| ssize_t n; # 193|-> struct stat fs; # 194| # 195| fn = filename; Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/histfile.c: scope_hint: In function ‘history_tempfile’ bash-5.2/lib/readline/histfile.c:221:15: warning[-Wunused-variable]: unused variable ‘fs’ # 221 | struct stat fs; # | ^~ # 219| size_t len; # 220| ssize_t n; # 221|-> struct stat fs; # 222| int pid; # 223| Error: COMPILER_WARNING (CWE-1164): bash-5.2/lib/readline/histfile.c: scope_hint: At top level bash-5.2/lib/readline/histfile.c:473:1: warning[-Wunused-function]: ‘histfile_backup’ defined but not used # 473 | histfile_backup (const char *filename, const char *back) # | ^~~~~~~~~~~~~~~ # 471| (e.g., ~/.bash_history -> .histfiles/.bash_history.$HOSTNAME) */ # 472| static int # 473|-> histfile_backup (const char *filename, const char *back) # 474| { # 475| #if defined (HAVE_READLINK) Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/histfile.c: scope_hint: In function ‘history_truncate_file’ bash-5.2/lib/readline/histfile.c:521:49: warning[-Wunused-but-set-variable]: variable ‘r’ set but not used # 521 | int file, chars_read, rv, orig_lines, exists, r; # | ^ # 519| { # 520| char *buffer, *filename, *tempname, *bp, *bp1; /* bp1 == bp+1 */ # 521|-> int file, chars_read, rv, orig_lines, exists, r; # 522| struct stat finfo, nfinfo; # 523| size_t file_size; Error: GCC_ANALYZER_WARNING (CWE-457): bash-5.2/lib/readline/histfile.c: scope_hint: In function ‘history_truncate_file’ bash-5.2/lib/readline/histfile.c:646:46: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘orig_lines’ # 644| FREE (buffer); # 645| # 646|-> history_lines_written_to_file = orig_lines - lines; # 647| # 648| if (rv == 0 && filename && tempname) Error: COMPILER_WARNING (CWE-457): bash-5.2/lib/readline/histfile.c: scope_hint: In function ‘history_truncate_file’ bash-5.2/lib/readline/histfile.c:646:46: warning[-Wmaybe-uninitialized]: ‘orig_lines’ may be used uninitialized # 646 | history_lines_written_to_file = orig_lines - lines; # | ~~~~~~~~~~~^~~~~~~ bash-5.2/lib/readline/histfile.c:521:29: note: ‘orig_lines’ was declared here # 521 | int file, chars_read, rv, orig_lines, exists, r; # | ^~~~~~~~~~ # 644| FREE (buffer); # 645| # 646|-> history_lines_written_to_file = orig_lines - lines; # 647| # 648| if (rv == 0 && filename && tempname) Error: CLANG_WARNING: bash-5.2/lib/readline/histfile.c:646:46: warning[core.UndefinedBinaryOperatorResult]: The left operand of '-' is a garbage value # 644| FREE (buffer); # 645| # 646|-> history_lines_written_to_file = orig_lines - lines; # 647| # 648| if (rv == 0 && filename && tempname) Error: CLANG_WARNING: bash-5.2/lib/readline/histfile.c:665:5: warning[deadcode.DeadStores]: Value stored to 'r' is never read # 663| owned by root. */ # 664| if (rv == 0 && exists && SHOULD_CHOWN (finfo, nfinfo)) # 665|-> r = chown (filename, finfo.st_uid, finfo.st_gid); # 666| #endif # 667| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/histfile.c: scope_hint: In function ‘history_do_write’ bash-5.2/lib/readline/histfile.c:683:22: warning[-Wunused-variable]: unused variable ‘nfinfo’ # 683 | struct stat finfo, nfinfo; # | ^~~~~~ # 681| char *output, *tempname, *histname; # 682| int file, mode, rv, exists; # 683|-> struct stat finfo, nfinfo; # 684| #ifdef HISTORY_USE_MMAP # 685| size_t cursize; Error: CLANG_WARNING: bash-5.2/lib/readline/histfile.c:809:5: warning[deadcode.DeadStores]: Value stored to 'mode' is never read # 807| owned by root. */ # 808| if (rv == 0 && exists) # 809|-> mode = chown (histname, finfo.st_uid, finfo.st_gid); # 810| #endif # 811| Error: CPPCHECK_WARNING: bash-5.2/lib/readline/history.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/history.c: scope_hint: In function ‘add_history’ bash-5.2/lib/readline/history.c:286:20: warning[-Wunused-variable]: unused variable ‘i’ # 286 | register int i; # | ^ # 284| if (history_stifled && (history_length == history_max_entries)) # 285| { # 286|-> register int i; # 287| # 288| /* If the history is stifled, and history_length is zero, Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/history.c: scope_hint: In function ‘remove_history’ bash-5.2/lib/readline/history.c:489:16: warning[-Wunused-variable]: unused variable ‘i’ # 489 | register int i; # | ^ # 487| { # 488| HIST_ENTRY *return_value; # 489|-> register int i; # 490| #if 1 # 491| int nentries; Error: CPPCHECK_WARNING: bash-5.2/lib/readline/histsearch.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/readline/histsearch.c: scope_hint: In function ‘_hs_history_patsearch’ bash-5.2/lib/readline/histsearch.c:212:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 212 | if (unescaped_backslash = (string[ret] == '\\')) # | ^~~~~~~~~~~~~~~~~~~ # 210| /* fnmatch is required to reject a pattern that ends with an unescaped # 211| backslash */ # 212|-> if (unescaped_backslash = (string[ret] == '\\')) # 213| { # 214| while (ret > 0 && string[--ret] == '\\') Error: CPPCHECK_WARNING: bash-5.2/lib/readline/input.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/lib/readline/input.c:275:3: warning[deadcode.DeadStores]: Value stored to 'result' is never read # 273| #endif # 274| # 275|-> result = -1; # 276| errno = 0; # 277| #if defined (FIONREAD) Error: CLANG_WARNING: bash-5.2/lib/readline/input.c:671:16: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 669| for `rl_timeout' and set `tmout_status = 1'. */ # 670| tmout_status = rl_timeout_remaining (&sec, &usec); # 671|-> tmout.tv_sec = sec; # 672| tmout.tv_usec = usec; # 673| Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/readline/input.c: scope_hint: In function ‘rl_read_key’ bash-5.2/lib/readline/input.c:764:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 764 | if (c = _rl_next_macro_key ()) # | ^ # 762| { # 763| /* If input is coming from a macro, then use that. */ # 764|-> if (c = _rl_next_macro_key ()) # 765| return ((unsigned char)c); # 766| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/input.c:809:12: warning[-Wunused-variable]: unused variable ‘empty_set’ # 809 | sigset_t empty_set; # | ^~~~~~~~~ # 807| int fd; # 808| #if defined (HAVE_PSELECT) # 809|-> sigset_t empty_set; # 810| fd_set readfds; # 811| #endif Error: CLANG_WARNING: bash-5.2/lib/readline/input.c:824:7: warning[deadcode.DeadStores]: Value stored to 'result' is never read # 822| return (_getch ()); /* "There is no error return." */ # 823| #endif # 824|-> result = 0; # 825| #if defined (HAVE_PSELECT) || defined (HAVE_SELECT) # 826| /* At this point, if we have pselect, we're using select/pselect for the Error: COMPILER_WARNING (CWE-1164): bash-5.2/lib/readline/input.c: scope_hint: In function ‘rl_getc’ bash-5.2/lib/readline/input.c:880:1: warning[-Wunused-label]: label ‘handle_error’ defined but not used # 880 | handle_error: # | ^~~~~~~~~~~~ # 878| /* fprintf(stderr, "rl_getc: result = %d errno = %d\n", result, errno); */ # 879| # 880|-> handle_error: # 881| /* If the error that we received was EINTR, then try again, # 882| this is simply an interrupted system call to read (). We allow Error: CPPCHECK_WARNING: bash-5.2/lib/readline/isearch.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/isearch.c: scope_hint: In function ‘_rl_isearch_dispatch’ bash-5.2/lib/readline/isearch.c:343:37: warning[-Wunused-variable]: unused variable ‘incr’ # 343 | int n, wstart, wlen, limit, cval, incr; # | ^~~~ # 341| _rl_isearch_dispatch (_rl_search_cxt *cxt, int c) # 342| { # 343|-> int n, wstart, wlen, limit, cval, incr; # 344| char *paste; # 345| size_t pastelen; Error: CLANG_WARNING: bash-5.2/lib/readline/isearch.c:362:89: warning[deadcode.DeadStores]: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' # 360| /* XXX - experimental code to allow users to bracketed-paste into the search # 361| string even when ESC is one of the isearch-terminators. Not perfect yet. */ # 362|-> if (_rl_enable_bracketed_paste && c == ESC && strchr (cxt->search_terminators, c) && (n = _rl_nchars_available ()) > (BRACK_PASTE_SLEN-1)) # 363| { # 364| j = _rl_read_bracketed_paste_prefix (c); Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/isearch.c: scope_hint: In function ‘rl_search_history’ bash-5.2/lib/readline/isearch.c:848:7: warning[-Wunused-but-set-variable]: variable ‘c’ set but not used # 848 | int c, r; # | ^ # 846| { # 847| _rl_search_cxt *cxt; /* local for now, but saved globally */ # 848|-> int c, r; # 849| # 850| RL_SETSTATE(RL_STATE_ISEARCH); Error: CLANG_WARNING: bash-5.2/lib/readline/isearch.c:860:3: warning[deadcode.DeadStores]: Value stored to 'r' is never read # 858| return (0); # 859| # 860|-> r = -1; # 861| for (;;) # 862| { Error: CLANG_WARNING: bash-5.2/lib/readline/isearch.c:863:7: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 861| for (;;) # 862| { # 863|-> c = _rl_search_getchar (cxt); # 864| /* We might want to handle EOF here (c == 0) */ # 865| r = _rl_isearch_dispatch (cxt, cxt->lastc); Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/isearch.c: scope_hint: In function ‘_rl_isearch_callback’ bash-5.2/lib/readline/isearch.c:885:7: warning[-Wunused-but-set-variable]: variable ‘c’ set but not used # 885 | int c, r; # | ^ # 883| _rl_isearch_callback (_rl_search_cxt *cxt) # 884| { # 885|-> int c, r; # 886| # 887| c = _rl_search_getchar (cxt); Error: CLANG_WARNING: bash-5.2/lib/readline/isearch.c:887:3: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 885| int c, r; # 886| # 887|-> c = _rl_search_getchar (cxt); # 888| /* We might want to handle EOF here */ # 889| r = _rl_isearch_dispatch (cxt, cxt->lastc); Error: CPPCHECK_WARNING: bash-5.2/lib/readline/kill.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-674): bash-5.2/lib/readline/kill.c: scope_hint: In function ‘rl_backward_kill_word’ bash-5.2/lib/readline/kill.c:202:13: warning[-Wanalyzer-infinite-recursion]: infinite recursion # 200| # 201| if (count < 0) # 202|-> return (rl_backward_kill_word (-count, key)); # 203| else # 204| { Error: GCC_ANALYZER_WARNING (CWE-674): bash-5.2/lib/readline/kill.c: scope_hint: In function ‘rl_kill_word’ bash-5.2/lib/readline/kill.c:225:13: warning[-Wanalyzer-infinite-recursion]: infinite recursion # 223| # 224| if (count < 0) # 225|-> return (rl_kill_word (-count, key)); # 226| else # 227| { Error: GCC_ANALYZER_WARNING (CWE-674): bash-5.2/lib/readline/kill.c: scope_hint: In function ‘rl_copy_backward_word’ bash-5.2/lib/readline/kill.c:494:13: warning[-Wanalyzer-infinite-recursion]: infinite recursion # 492| { # 493| if (count < 0) # 494|-> return (rl_copy_backward_word (-count, key)); # 495| # 496| return (_rl_copy_word_as_kill (count, 1)); Error: GCC_ANALYZER_WARNING (CWE-674): bash-5.2/lib/readline/kill.c: scope_hint: In function ‘rl_copy_forward_word’ bash-5.2/lib/readline/kill.c:503:13: warning[-Wanalyzer-infinite-recursion]: infinite recursion # 501| { # 502| if (count < 0) # 503|-> return (rl_copy_forward_word (-count, key)); # 504| # 505| return (_rl_copy_word_as_kill (count, -1)); Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/kill.c: scope_hint: In function ‘rl_vi_yank_pop’ bash-5.2/lib/readline/kill.c:562:13: warning[-Wunused-variable]: unused variable ‘origpoint’ # 562 | int l, n, origpoint; # | ^~~~~~~~~ # 560| rl_vi_yank_pop (int count, int key) # 561| { # 562|-> int l, n, origpoint; # 563| # 564| if (((rl_last_func != rl_vi_yank_pop) && (rl_last_func != rl_vi_put)) || Error: CLANG_WARNING: bash-5.2/lib/readline/kill.c:615:2: warning[deadcode.DeadStores]: Value stored to 'entry' is never read # 613| { # 614| for (i = 0; i < history_skip; i++) # 615|-> entry = previous_history (); # 616| } # 617| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/kill.c:759:15: warning[-Wunused-variable]: unused variable ‘c’ # 759 | int retval, c; # | ^ # 757| rl_bracketed_paste_begin (int count, int key) # 758| { # 759|-> int retval, c; # 760| size_t len, cap; # 761| char *buf; Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/kill.c: scope_hint: In function ‘rl_bracketed_paste_begin’ bash-5.2/lib/readline/kill.c:760:15: warning[-Wunused-variable]: unused variable ‘cap’ # 760 | size_t len, cap; # | ^~~ # 758| { # 759| int retval, c; # 760|-> size_t len, cap; # 761| char *buf; # 762| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/kill.c: scope_hint: In function ‘_rl_read_bracketed_paste_prefix’ bash-5.2/lib/readline/kill.c:777:17: warning[-Wunused-variable]: unused variable ‘j’ # 777 | int key, ind, j; # | ^ # 775| { # 776| char pbuf[BRACK_PASTE_SLEN+1], *pbpref; # 777|-> int key, ind, j; # 778| # 779| pbpref = BRACK_PASTE_PREF; /* XXX - debugging */ Error: CLANG_WARNING: bash-5.2/lib/readline/kill.c:800:19: warning[core.UndefinedBinaryOperatorResult]: The left operand of '<' is a garbage value # 798| while (ind >= 0) # 799| _rl_unget_char (pbuf[ind--]); # 800|-> return (key < 0 ? key : 0); # 801| } # 802| return (key < 0 ? key : 1); Error: GCC_ANALYZER_WARNING (CWE-457): bash-5.2/lib/readline/kill.c: scope_hint: In function ‘_rl_read_bracketed_paste_prefix’ bash-5.2/lib/readline/kill.c:800:29: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘key’ bash-5.2/lib/readline/kill.c:46: included_from: Included from here. bash-5.2/lib/readline/kill.c:784:11: note: in expansion of macro ‘RL_ISSTATE’ # 798| while (ind >= 0) # 799| _rl_unget_char (pbuf[ind--]); # 800|-> return (key < 0 ? key : 0); # 801| } # 802| return (key < 0 ? key : 1); Error: COMPILER_WARNING (CWE-457): bash-5.2/lib/readline/kill.c: scope_hint: In function ‘_rl_read_bracketed_paste_prefix’ bash-5.2/lib/readline/kill.c:800:29: warning[-Wmaybe-uninitialized]: ‘key’ may be used uninitialized # 800 | return (key < 0 ? key : 0); # | ~~~~~~~~~~~~~~~^~~~ bash-5.2/lib/readline/kill.c:777:7: note: ‘key’ was declared here # 777 | int key, ind, j; # | ^~~ # 798| while (ind >= 0) # 799| _rl_unget_char (pbuf[ind--]); # 800|-> return (key < 0 ? key : 0); # 801| } # 802| return (key < 0 ? key : 1); Error: CLANG_WARNING: bash-5.2/lib/readline/kill.c:823:50: warning[deadcode.DeadStores]: Although the value stored to 'r' is used in the enclosing expression, the value is never actually read from 'r' # 821| # 822| /* read pasted data with bracketed-paste mode enabled. */ # 823|-> if (_rl_enable_bracketed_paste && c == ESC && (r = _rl_read_bracketed_paste_prefix (c)) == 1) # 824| { # 825| pbuf = _rl_bracketed_text (&pblen); Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/kill.c: scope_hint: In function ‘_rl_bracketed_read_mbstring’ bash-5.2/lib/readline/kill.c:849:10: warning[-Wunused-variable]: unused variable ‘r’ # 849 | int c, r; # | ^ # 847| _rl_bracketed_read_mbstring (char *mb, int mlen) # 848| { # 849|-> int c, r; # 850| # 851| c = _rl_bracketed_read_key (); Error: CPPCHECK_WARNING: bash-5.2/lib/readline/mbutil.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-1164): bash-5.2/lib/readline/mbutil.c: scope_hint: At top level bash-5.2/lib/readline/mbutil.c:87:1: warning[-Wunused-function]: ‘_rl_utf8_mblen’ defined but not used # 87 | _rl_utf8_mblen (const char *s, size_t n) # | ^~~~~~~~~~~~~~ # 85| at S. Encoding is UTF-8. */ # 86| static int # 87|-> _rl_utf8_mblen (const char *s, size_t n) # 88| { # 89| unsigned char c, c1, c2, c3; Error: CLANG_WARNING: bash-5.2/lib/readline/mbutil.c:158:3: warning[deadcode.DeadStores]: Value stored to 'tmp' is never read # 156| WCHAR_T wc; # 157| # 158|-> tmp = 0; # 159| # 160| memset(&ps, 0, sizeof (mbstate_t)); Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/mbutil.c: scope_hint: In function ‘_rl_find_prev_utf8char’ bash-5.2/lib/readline/mbutil.c:247:9: warning[-Wunused-variable]: unused variable ‘s’ # 247 | char *s; # | ^ # 245| _rl_find_prev_utf8char (char *string, int seed, int find_non_zero) # 246| { # 247|-> char *s; # 248| unsigned char b; # 249| int save, prev; Error: CLANG_WARNING: bash-5.2/lib/readline/mbutil.c:309:10: warning[deadcode.DeadStores]: Although the value stored to 'non_zero_prev' is used in the enclosing expression, the value is never actually read from 'non_zero_prev' # 307| return length; # 308| # 309|-> prev = non_zero_prev = point = 0; # 310| while (point < seed) # 311| { Error: CLANG_WARNING: bash-5.2/lib/readline/mbutil.c:425:3: warning[deadcode.DeadStores]: Value stored to 'tmp' is never read # 423| int length, pos; # 424| # 425|-> tmp = 0; # 426| pos = 0; # 427| length = strlen(string); Error: CPPCHECK_WARNING: bash-5.2/lib/readline/misc.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/misc.c: scope_hint: In function ‘_rl_free_saved_history_line’ bash-5.2/lib/readline/misc.c:385:14: warning[-Wunused-variable]: unused variable ‘orig’ # 385 | UNDO_LIST *orig; # | ^~~~ # 383| _rl_free_saved_history_line (void) # 384| { # 385|-> UNDO_LIST *orig; # 386| # 387| if (_rl_saved_line_for_history) Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/readline/misc.c: scope_hint: In function ‘_rl_revert_previous_lines’ bash-5.2/lib/readline/misc.c:460:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 460 | if (ul = (UNDO_LIST *)entry->data) # | ^~ # 458| while (entry) # 459| { # 460|-> if (ul = (UNDO_LIST *)entry->data) # 461| { # 462| if (ul == saved_undo_list) Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/readline/misc.c: scope_hint: In function ‘rl_clear_history’ bash-5.2/lib/readline/misc.c:520:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 520 | if (ul = (UNDO_LIST *)hent->data) # | ^~ # 518| { # 519| hent = hlist[i]; # 520|-> if (ul = (UNDO_LIST *)hent->data) # 521| { # 522| if (ul == saved_undo_list) Error: CPPCHECK_WARNING: bash-5.2/lib/readline/nls.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/nls.c: scope_hint: In function ‘utf8locale’ bash-5.2/lib/readline/nls.c:110:10: warning[-Wunused-variable]: unused variable ‘len’ # 110 | size_t len; # | ^~~ # 108| { # 109| char *cp; # 110|-> size_t len; # 111| # 112| #if HAVE_LANGINFO_CODESET Error: COMPILER_WARNING (CWE-1164): bash-5.2/lib/readline/nls.c: scope_hint: At top level bash-5.2/lib/readline/nls.c:286:1: warning[-Wunused-function]: ‘find_codeset’ defined but not used # 286 | find_codeset (char *name, size_t *lenp) # | ^~~~~~~~~~~~ # 284| /* Isolate codeset portion of locale specification. */ # 285| static char * # 286|-> find_codeset (char *name, size_t *lenp) # 287| { # 288| char *cp, *language, *result; Error: CPPCHECK_WARNING: bash-5.2/lib/readline/parens.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/parens.c: scope_hint: In function ‘rl_insert_close’ bash-5.2/lib/readline/parens.c:118:36: warning[-Wunused-but-set-variable]: variable ‘ready’ set but not used # 118 | int orig_point, match_point, ready; # | ^~~~~ # 116| { # 117| #if defined (HAVE_SELECT) # 118|-> int orig_point, match_point, ready; # 119| struct timeval timer; # 120| fd_set readfds; Error: CLANG_WARNING: bash-5.2/lib/readline/parens.c:141:7: warning[deadcode.DeadStores]: Value stored to 'ready' is never read # 139| ready = _rl_timeout_select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer, NULL); # 140| # else # 141|-> ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer); # 142| # endif # 143| rl_point = orig_point; Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/readline.c:76: included_from: Included from here. bash-5.2/lib/readline/parse-colors.h:44:14: warning[-Wunused-variable]: ‘color_buf’ defined but not used # 44 | static char *color_buf; # | ^~~~~~~~~ # 42| # 43| /* Buffer for color sequences */ # 44|-> static char *color_buf; # 45| # 46| #endif /* !_PARSE_COLORS_H_ */ Error: CPPCHECK_WARNING: bash-5.2/lib/readline/readline.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/readline.c:567:21: warning[-Wunused-variable]: unused variable ‘eof_found’ # 567 | static int lastc, eof_found; # | ^~~~~~~~~ # 565| #endif # 566| { # 567|-> static int lastc, eof_found; # 568| int c, code, lk, r; # 569| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/readline.c: scope_hint: In function ‘readline_internal_char’ bash-5.2/lib/readline/readline.c:568:20: warning[-Wunused-but-set-variable]: variable ‘r’ set but not used # 568 | int c, code, lk, r; # | ^ # 566| { # 567| static int lastc, eof_found; # 568|-> int c, code, lk, r; # 569| # 570| lastc = EOF; Error: CLANG_WARNING: bash-5.2/lib/readline/readline.c:675:7: warning[deadcode.DeadStores]: Value stored to 'r' is never read # 673| # 674| lastc = c; # 675|-> r = _rl_dispatch ((unsigned char)c, _rl_keymap); # 676| RL_CHECK_SIGNALS (); # 677| Error: CLANG_WARNING: bash-5.2/lib/readline/readline.c:689:4: warning[deadcode.DeadStores]: Value stored to 'r' is never read # 687| rl_dispatching = 1; # 688| RL_SETSTATE(RL_STATE_DISPATCHING); # 689|-> r = (*(_rl_command_to_execute->func)) (_rl_command_to_execute->count, _rl_command_to_execute->key); # 690| _rl_command_to_execute = 0; # 691| RL_UNSETSTATE(RL_STATE_DISPATCHING); Error: COMPILER_WARNING (CWE-1164): bash-5.2/lib/readline/readline.c: scope_hint: At top level bash-5.2/lib/readline/readline.c:1343:1: warning[-Wunused-function]: ‘reset_default_bindings’ defined but not used # 1343 | reset_default_bindings (void) # | ^~~~~~~~~~~~~~~~~~~~~~ # 1341| interested in back to rl_insert and read the new ones. */ # 1342| static void # 1343|-> reset_default_bindings (void) # 1344| { # 1345| if (_rl_bind_stty_chars) Error: CPPCHECK_WARNING: bash-5.2/lib/readline/search.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/lib/readline/search.c:334:43: warning[deadcode.DeadStores]: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' # 332| number of chars in the input queue is enough for the bracketed paste # 333| prefix and hope for the best. */ # 334|-> if (_rl_enable_bracketed_paste && ((n = _rl_nchars_available ()) >= (BRACK_PASTE_SLEN-1))) # 335| { # 336| if (_rl_read_bracketed_paste_prefix (c) == 1) Error: CLANG_WARNING: bash-5.2/lib/readline/search.c:421:3: warning[deadcode.DeadStores]: Value stored to 'r' is never read # 419| # 420| /* Read the search string. */ # 421|-> r = 0; # 422| while (1) # 423| { Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/search.c:533:7: warning[-Wunused-but-set-variable]: variable ‘had_saved_line’ set but not used # 533 | int had_saved_line; # | ^~~~~~~~~~~~~~ # 531| HIST_ENTRY *temp; # 532| int ret, oldpos, newcol; # 533|-> int had_saved_line; # 534| char *t; # 535| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/search.c: scope_hint: In function ‘rl_history_search_internal’ bash-5.2/lib/readline/search.c:534:9: warning[-Wunused-variable]: unused variable ‘t’ # 534 | char *t; # | ^ # 532| int ret, oldpos, newcol; # 533| int had_saved_line; # 534|-> char *t; # 535| # 536| had_saved_line = _rl_saved_line_for_history != 0; Error: CLANG_WARNING: bash-5.2/lib/readline/search.c:536:3: warning[deadcode.DeadStores]: Value stored to 'had_saved_line' is never read # 534| char *t; # 535| # 536|-> had_saved_line = _rl_saved_line_for_history != 0; # 537| rl_maybe_save_line (); # 538| temp = (HIST_ENTRY *)NULL; Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/shell.c:125:13: warning[-Wunused-variable]: ‘putenv_buf1’ defined but not used # 125 | static char putenv_buf1[INT_STRLEN_BOUND (int) + 6 + 1]; /* sizeof("LINES=") == 6 */ # | ^~~~~~~~~~~ # 123| respectively. */ # 124| static char setenv_buf[INT_STRLEN_BOUND (int) + 1]; # 125|-> static char putenv_buf1[INT_STRLEN_BOUND (int) + 6 + 1]; /* sizeof("LINES=") == 6 */ # 126| static char putenv_buf2[INT_STRLEN_BOUND (int) + 8 + 1]; /* sizeof("COLUMNS=") == 8 */ # 127| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/shell.c:126:13: warning[-Wunused-variable]: ‘putenv_buf2’ defined but not used # 126 | static char putenv_buf2[INT_STRLEN_BOUND (int) + 8 + 1]; /* sizeof("COLUMNS=") == 8 */ # | ^~~~~~~~~~~ # 124| static char setenv_buf[INT_STRLEN_BOUND (int) + 1]; # 125| static char putenv_buf1[INT_STRLEN_BOUND (int) + 6 + 1]; /* sizeof("LINES=") == 6 */ # 126|-> static char putenv_buf2[INT_STRLEN_BOUND (int) + 8 + 1]; /* sizeof("COLUMNS=") == 8 */ # 127| # 128| void Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/signals.c: scope_hint: In function ‘rl_set_signals’ bash-5.2/lib/readline/signals.c:414:25: warning[-Wunused-variable]: unused variable ‘oset’ # 414 | static sigset_t bset, oset; # | ^~~~ # 412| #if defined (HAVE_POSIX_SIGNALS) # 413| static int sigmask_set = 0; # 414|-> static sigset_t bset, oset; # 415| #endif # 416| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/signals.c:625:17: warning[-Wunused-variable]: ‘sigint_set’ defined but not used # 625 | static sigset_t sigint_set, sigint_oset; # | ^~~~~~~~~~ # 623| # 624| #if defined (HAVE_POSIX_SIGNALS) # 625|-> static sigset_t sigint_set, sigint_oset; # 626| static sigset_t sigwinch_set, sigwinch_oset; # 627| #else /* !HAVE_POSIX_SIGNALS */ Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/signals.c: scope_hint: At top level bash-5.2/lib/readline/signals.c:625:29: warning[-Wunused-variable]: ‘sigint_oset’ defined but not used # 625 | static sigset_t sigint_set, sigint_oset; # | ^~~~~~~~~~~ # 623| # 624| #if defined (HAVE_POSIX_SIGNALS) # 625|-> static sigset_t sigint_set, sigint_oset; # 626| static sigset_t sigwinch_set, sigwinch_oset; # 627| #else /* !HAVE_POSIX_SIGNALS */ Error: CPPCHECK_WARNING: bash-5.2/lib/readline/terminal.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/lib/readline/text.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING: bash-5.2/lib/readline/text.c: scope_hint: In function ‘rl_insert_text’ bash-5.2/lib/readline/text.c:100:3: warning[-Wstringop-truncation]: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length # 100 | strncpy (rl_line_buffer + rl_point, string, l); # | ^ bash-5.2/lib/readline/text.c:90:29: note: length computed here # 90 | l = (string && *string) ? strlen (string) : 0; # | ^~~~~~~~~~~~~~~ # 98| rl_line_buffer[i + l] = rl_line_buffer[i]; # 99| # 100|-> strncpy (rl_line_buffer + rl_point, string, l); # 101| # 102| /* Remember how to undo this if we aren't undoing something. */ Error: GCC_ANALYZER_WARNING (CWE-674): bash-5.2/lib/readline/text.c: scope_hint: In function ‘rl_forward_byte’ bash-5.2/lib/readline/text.c:396:13: warning[-Wanalyzer-infinite-recursion]: infinite recursion # 394| { # 395| if (count < 0) # 396|-> return (rl_forward_byte (-count, key)); # 397| # 398| if (count > 0) Error: CLANG_WARNING: bash-5.2/lib/readline/text.c:817:7: warning[deadcode.DeadStores]: Value stored to 'incoming_length' is never read # 815| } # 816| } # 817|-> incoming_length = 0; # 818| stored_count = 0; # 819| #else /* !HANDLE_MULTIBYTE */ Error: CLANG_WARNING: bash-5.2/lib/readline/text.c:861:7: warning[deadcode.DeadStores]: Value stored to 'incoming_length' is never read # 859| # 860| xfree (string); # 861|-> incoming_length = 0; # 862| stored_count = 0; # 863| #else /* !HANDLE_MULTIBYTE */ Error: CPPCHECK_WARNING: bash-5.2/lib/readline/tilde.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/lib/readline/tilde.c:194:18: warning[deadcode.DeadStores]: Although the value stored to 'result_size' is used in the enclosing expression, the value is never actually read from 'result_size' # 192| int result_size, result_index; # 193| # 194|-> result_index = result_size = 0; # 195| if (result = strchr (string, '~')) # 196| result = (char *)xmalloc (result_size = (strlen (string) + 16)); Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/readline/tilde.c: scope_hint: In function ‘tilde_expand’ bash-5.2/lib/readline/tilde.c:195:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 195 | if (result = strchr (string, '~')) # | ^~~~~~ # 193| # 194| result_index = result_size = 0; # 195|-> if (result = strchr (string, '~')) # 196| result = (char *)xmalloc (result_size = (strlen (string) + 16)); # 197| else Error: CLANG_WARNING: bash-5.2/lib/readline/tilde.c:195:7: warning[deadcode.DeadStores]: Although the value stored to 'result' is used in the enclosing expression, the value is never actually read from 'result' # 193| # 194| result_index = result_size = 0; # 195|-> if (result = strchr (string, '~')) # 196| result = (char *)xmalloc (result_size = (strlen (string) + 16)); # 197| else Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/undo.c: scope_hint: In function ‘rl_free_undo_list’ bash-5.2/lib/readline/undo.c:119:14: warning[-Wunused-variable]: unused variable ‘release’ # 119 | UNDO_LIST *release, *orig_list; # | ^~~~~~~ # 117| rl_free_undo_list (void) # 118| { # 119|-> UNDO_LIST *release, *orig_list; # 120| # 121| orig_list = rl_undo_list; Error: CPPCHECK_WARNING (CWE-457): bash-5.2/lib/readline/undo.c:154: warning[uninitvar]: Uninitialized variable: roving # 152| else # 153| { # 154|-> roving->next = c; # 155| roving = roving->next; # 156| } Error: GCC_ANALYZER_WARNING (CWE-775): bash-5.2/lib/readline/util.c: scope_hint: In function ‘_rl_audit_tty’ bash-5.2/lib/readline/util.c:555:5: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘fd’ # 553| fd = socket (PF_NETLINK, SOCK_RAW, NETLINK_AUDIT); # 554| if (fd < 0) # 555|-> return; # 556| size = strlen (string) + 1; # 557| Error: CPPCHECK_WARNING: bash-5.2/lib/readline/vi_mode.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/vi_mode.c: scope_hint: At top level bash-5.2/lib/readline/vi_mode.c:104:12: warning[-Wunused-variable]: ‘vi_continued_command’ defined but not used # 104 | static int vi_continued_command; # | ^~~~~~~~~~~~~~~~~~~~ # 102| us implicitly into insert mode. Some people want this text to be # 103| attached to the command so that it is `redoable' with `.'. */ # 104|-> static int vi_continued_command; # 105| static char *vi_insert_buffer; # 106| static int vi_insert_buffer_size; Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/vi_mode.c: scope_hint: In function ‘rl_vi_fword’ bash-5.2/lib/readline/vi_mode.c:622:7: warning[-Wunused-but-set-variable]: variable ‘opoint’ set but not used # 622 | int opoint; # | ^~~~~~ # 620| rl_vi_fword (int count, int ignore) # 621| { # 622|-> int opoint; # 623| # 624| while (count-- && rl_point < (rl_end - 1)) Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/readline/vi_mode.c: scope_hint: In function ‘rl_vi_domove’ bash-5.2/lib/readline/vi_mode.c:1343:7: warning[-Wunused-variable]: unused variable ‘r’ # 1343 | int r; # | ^ # 1341| rl_vi_domove (int x, int *ignore) # 1342| { # 1343|-> int r; # 1344| _rl_vimotion_cxt *m; # 1345| Error: COMPILER_WARNING: bash-5.2/lib/readline/vi_mode.c: scope_hint: In function ‘rl_vi_change_char’ bash-5.2/lib/readline/vi_mode.c:2069:7: warning[-Wstringop-truncation]: ‘strncpy’ output may be truncated copying 16 bytes from a string of length 16 # 2069 | strncpy (mb, _rl_vi_last_replacement, MB_LEN_MAX); # | ^ # 2067| if (_rl_vi_redoing) # 2068| { # 2069|-> strncpy (mb, _rl_vi_last_replacement, MB_LEN_MAX); # 2070| c = (unsigned char)_rl_vi_last_replacement[0]; /* XXX */ # 2071| mb[MB_LEN_MAX] = '\0'; Error: CPPCHECK_WARNING: bash-5.2/lib/sh/casemod.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/casemod.c: scope_hint: In function ‘sh_modcase’ bash-5.2/lib/sh/casemod.c:107:15: warning[-Wunused-variable]: unused variable ‘c’ # 107 | int inword, c, nc, nop, match, usewords; # | ^ # 105| { # 106| int start, next, end, retind; # 107|-> int inword, c, nc, nop, match, usewords; # 108| char *ret, *s; # 109| wchar_t wc; Error: COMPILER_WARNING (CWE-1164): bash-5.2/lib/sh/eaccess.c:176:1: warning[-Wunused-function]: ‘sh_euidaccess’ defined but not used # 176 | sh_euidaccess (path, mode) # | ^~~~~~~~~~~~~ # 174| the effective and real uid and gid as appropriate. */ # 175| static int # 176|-> sh_euidaccess (path, mode) # 177| const char *path; # 178| int mode; Error: CLANG_WARNING: bash-5.2/lib/sh/fmtullong.c:29: included_from: Included from here. bash-5.2/lib/sh/fmtulong.c:105:15: warning[deadcode.DeadStores]: Although the value stored to 'p' is used in the enclosing expression, the value is never actually read from 'p' # 103| buf[len-1] = '\0'; # 104| errno = EINVAL; # 105|-> return (p = buf); # 106| #else # 107| base = 10; Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/fnxform.c:49:14: warning[-Wunused-variable]: ‘outbuf’ defined but not used # 49 | static char *outbuf = 0; # | ^~~~~~ # 47| #define OUTLEN_MAX 4096 # 48| # 49|-> static char *outbuf = 0; # 50| static size_t outlen = 0; # 51| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/fnxform.c:50:15: warning[-Wunused-variable]: ‘outlen’ defined but not used # 50 | static size_t outlen = 0; # | ^~~~~~ # 48| # 49| static char *outbuf = 0; # 50|-> static size_t outlen = 0; # 51| # 52| static char *curencoding PARAMS((void)); Error: COMPILER_WARNING (CWE-1164): bash-5.2/lib/sh/fnxform.c:80:1: warning[-Wunused-function]: ‘init_tofs’ defined but not used # 80 | init_tofs () # | ^~~~~~~~~ # 78| # 79| static void # 80|-> init_tofs () # 81| { # 82| char *cur; Error: COMPILER_WARNING (CWE-1164): bash-5.2/lib/sh/fnxform.c:89:1: warning[-Wunused-function]: ‘init_fromfs’ defined but not used # 89 | init_fromfs () # | ^~~~~~~~~~~ # 87| # 88| static void # 89|-> init_fromfs () # 90| { # 91| char *cur; Error: CPPCHECK_WARNING: bash-5.2/lib/sh/getenv.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING: bash-5.2/lib/sh/getenv.c: scope_hint: In function ‘getenv’ bash-5.2/lib/sh/getenv.c:55:6: warning[-Wnonnull-compare]: ‘nonnull’ argument ‘name’ compared to NULL # 55 | if (name == 0 || *name == '\0') # | ^ # 53| SHELL_VAR *var; # 54| # 55|-> if (name == 0 || *name == '\0') # 56| return ((char *)NULL); # 57| Error: COMPILER_WARNING: bash-5.2/lib/sh/getenv.c: scope_hint: In function ‘putenv’ bash-5.2/lib/sh/getenv.c:112:6: warning[-Wnonnull-compare]: ‘nonnull’ argument ‘str’ compared to NULL # 112 | if (str == 0 || *str == '\0') # | ^ # 110| int offset; # 111| # 112|-> if (str == 0 || *str == '\0') # 113| { # 114| errno = EINVAL; Error: COMPILER_WARNING: bash-5.2/lib/sh/getenv.c: scope_hint: In function ‘unsetenv’ bash-5.2/lib/sh/getenv.c:214:6: warning[-Wnonnull-compare]: ‘nonnull’ argument ‘name’ compared to NULL # 214 | if (name == 0 || *name == '\0' || strchr (name, '=') != 0) # | ^ # 212| const char *name; # 213| { # 214|-> if (name == 0 || *name == '\0' || strchr (name, '=') != 0) # 215| { # 216| errno = EINVAL; Error: CLANG_WARNING: bash-5.2/lib/sh/input_avail.c:140:7: warning[deadcode.DeadStores]: Value stored to 'result' is never read # 138| while (1) # 139| { # 140|-> result = 0; # 141| #if defined (HAVE_PSELECT) # 142| /* XXX - use pselect(2) to block SIGCHLD atomically */ Error: CPPCHECK_WARNING: bash-5.2/lib/sh/mailstat.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/lib/sh/makepath.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/sh/makepath.c: scope_hint: In function ‘sh_makepath’ bash-5.2/lib/sh/makepath.c:123:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 123 | while (*r++ = *s++) # | ^ # 121| *r++ = '/'; # 122| s = xdir; # 123|-> while (*r++ = *s++) # 124| ; # 125| if (xpath != path && xpath != nullpath) Error: CPPCHECK_WARNING: bash-5.2/lib/sh/mbscasecmp.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/lib/sh/mbscasecmp.c:41:3: warning[deadcode.DeadStores]: Value stored to 'len1' is never read # 39| wchar_t c1, c2, l1, l2; # 40| # 41|-> len1 = len2 = 0; # 42| /* Reset multibyte characters to their initial state. */ # 43| (void) mblen ((char *) NULL, 0); Error: CLANG_WARNING: bash-5.2/lib/sh/mbscasecmp.c:41:10: warning[deadcode.DeadStores]: Although the value stored to 'len2' is used in the enclosing expression, the value is never actually read from 'len2' # 39| wchar_t c1, c2, l1, l2; # 40| # 41|-> len1 = len2 = 0; # 42| /* Reset multibyte characters to their initial state. */ # 43| (void) mblen ((char *) NULL, 0); Error: CLANG_WARNING: bash-5.2/lib/sh/mbscmp.c:42:3: warning[deadcode.DeadStores]: Value stored to 'len1' is never read # 40| wchar_t c1, c2; # 41| # 42|-> len1 = len2 = 0; # 43| /* Reset multibyte characters to their initial state. */ # 44| (void) mblen ((char *) NULL, 0); Error: CLANG_WARNING: bash-5.2/lib/sh/mbscmp.c:42:10: warning[deadcode.DeadStores]: Although the value stored to 'len2' is used in the enclosing expression, the value is never actually read from 'len2' # 40| wchar_t c1, c2; # 41| # 42|-> len1 = len2 = 0; # 43| /* Reset multibyte characters to their initial state. */ # 44| (void) mblen ((char *) NULL, 0); Error: CPPCHECK_WARNING (CWE-457): bash-5.2/lib/sh/netopen.c:267: warning[uninitvar]: Uninitialized variable: s # 265| break; # 266| } # 267|-> return s; # 268| } # 269| #endif /* HAVE_GETADDRINFO */ Error: CLANG_WARNING: bash-5.2/lib/sh/netopen.c:267:3: warning[core.uninitialized.UndefReturn]: Undefined or garbage value returned to caller # 265| break; # 266| } # 267|-> return s; # 268| } # 269| #endif /* HAVE_GETADDRINFO */ Error: CPPCHECK_WARNING: bash-5.2/lib/sh/pathcanon.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/sh/pathcanon.c: scope_hint: In function ‘sh_canonpath’ bash-5.2/lib/sh/pathcanon.c:117:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 117 | if (rooted = ROOTEDPATH(path)) # | ^~~~~~ # 115| /* POSIX.2 says to leave a leading `//' alone. On cygwin, we skip over any # 116| leading `x:' (dos drive name). */ # 117|-> if (rooted = ROOTEDPATH(path)) # 118| { # 119| stub_char = DIRSEP; Error: CPPCHECK_WARNING: bash-5.2/lib/sh/pathphys.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-704): bash-5.2/lib/sh/random.c: scope_hint: In function ‘genseed’ bash-5.2/lib/sh/random.c:93:8: warning[-Wpointer-to-int-cast]: cast from pointer to integer of different size # 91| # 92| gettimeofday (&tv, NULL); # 93|-> iv = (u_bits32_t)seedrand; /* let the compiler truncate */ # 94| iv = tv.tv_sec ^ tv.tv_usec ^ getpid () ^ getppid () ^ current_user.uid ^ iv; # 95| return (iv); Error: COMPILER_WARNING (CWE-1164): bash-5.2/lib/sh/random.c:141:1: warning[-Wunused-function]: ‘brand32’ defined but not used # 141 | brand32 () # | ^~~~~~~ # 139| /* Returns a 32-bit pseudo-random number between 0 and 4294967295. */ # 140| static u_bits32_t # 141|-> brand32 () # 142| { # 143| u_bits32_t ret; Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/random.c: scope_hint: In function ‘brand32’ bash-5.2/lib/sh/random.c:143:14: warning[-Wunused-variable]: unused variable ‘ret’ # 143 | u_bits32_t ret; # | ^~~ # 141| brand32 () # 142| { # 143|-> u_bits32_t ret; # 144| # 145| rseed32 = intrand32 (rseed32); Error: COMPILER_WARNING (CWE-1164): bash-5.2/lib/sh/random.c: scope_hint: At top level bash-5.2/lib/sh/random.c:166:1: warning[-Wunused-function]: ‘perturb_rand32’ defined but not used # 166 | perturb_rand32 () # | ^~~~~~~~~~~~~~ # 164| # 165| static void # 166|-> perturb_rand32 () # 167| { # 168| rseed32 ^= genseed (); Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/setlinebuf.c:33:14: warning[-Wunused-variable]: ‘stdoutbuf’ defined but not used # 33 | static char *stdoutbuf = 0; # | ^~~~~~~~~ # 31| #endif # 32| # 33|-> static char *stdoutbuf = 0; # 34| static char *stderrbuf = 0; # 35| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/setlinebuf.c:34:14: warning[-Wunused-variable]: ‘stderrbuf’ defined but not used # 34 | static char *stderrbuf = 0; # | ^~~~~~~~~ # 32| # 33| static char *stdoutbuf = 0; # 34|-> static char *stderrbuf = 0; # 35| # 36| /* Cause STREAM to buffer lines as opposed to characters or blocks. */ Error: CPPCHECK_WARNING: bash-5.2/lib/sh/shquote.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/lib/sh/spell.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/lib/sh/spell.c:80:41: warning[core.UndefinedBinaryOperatorResult]: The left operand of '==' is a garbage value # 78| { # 79| /* `.' is rarely the right thing. */ # 80|-> if (oldname[1] == '\0' && newname[1] == '\0' && # 81| oldname[0] != '.' && newname[0] == '.') # 82| return -1; Error: GCC_ANALYZER_WARNING (CWE-457): bash-5.2/lib/sh/spell.c: scope_hint: In function ‘spname’ bash-5.2/lib/sh/spell.c:80:44: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘newname[1]’ # 78| { # 79| /* `.' is rarely the right thing. */ # 80|-> if (oldname[1] == '\0' && newname[1] == '\0' && # 81| oldname[0] != '.' && newname[0] == '.') # 82| return -1; Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/sh/spell.c: scope_hint: In function ‘spname’ bash-5.2/lib/sh/spell.c:98:22: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 98 | for (p = best; *np = *p++; np++) # | ^ # 96| * Add to end of newname # 97| */ # 98|-> for (p = best; *np = *p++; np++) # 99| ; # 100| } Error: GCC_ANALYZER_WARNING (CWE-457): bash-5.2/lib/sh/spell.c: scope_hint: In function ‘mindist’ bash-5.2/lib/sh/spell.c:143:11: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*best’ # 141| # 142| /* Don't return `.' */ # 143|-> if (best[0] == '.' && best[1] == '\0') # 144| dist = 3; # 145| return dist; Error: CLANG_WARNING: bash-5.2/lib/sh/spell.c:143:15: warning[core.UndefinedBinaryOperatorResult]: The left operand of '==' is a garbage value # 141| # 142| /* Don't return `.' */ # 143|-> if (best[0] == '.' && best[1] == '\0') # 144| dist = 3; # 145| return dist; Error: CLANG_WARNING: bash-5.2/lib/sh/stringlist.c:71:13: warning[deadcode.DeadStores]: Although the value stored to 'sl' is used in the enclosing expression, the value is never actually read from 'sl' # 69| # 70| if (sl == 0) # 71|-> return (sl = strlist_create (n)); # 72| # 73| if (n > sl->list_size) Error: GCC_ANALYZER_WARNING (CWE-476): bash-5.2/lib/sh/stringlist.c: scope_hint: In function ‘strlist_copy’ bash-5.2/lib/sh/stringlist.c:134:22: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ bash-5.2/lib/sh/stringlist.c:35:27: note: in definition of macro ‘STRDUP’ bash-5.2/lib/sh/stringlist.c:134:24: note: in expansion of macro ‘STRDUP’ # 132| { # 133| for (i = 0; i < sl->list_size; i++) # 134|-> new->list[i] = STRDUP (sl->list[i]); # 135| } # 136| new->list_size = sl->list_size; Error: GCC_ANALYZER_WARNING (CWE-476): bash-5.2/lib/sh/stringlist.c: scope_hint: In function ‘strlist_merge’ bash-5.2/lib/sh/stringlist.c:158:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ bash-5.2/lib/sh/stringlist.c:35:27: note: in definition of macro ‘STRDUP’ bash-5.2/lib/sh/stringlist.c:158:19: note: in expansion of macro ‘STRDUP’ # 156| sl = strlist_create (l1 + l2 + 1); # 157| for (i = n = 0; i < l1; i++, n++) # 158|-> sl->list[n] = STRDUP (m1->list[i]); # 159| for (i = 0; i < l2; i++, n++) # 160| sl->list[n] = STRDUP (m2->list[i]); Error: GCC_ANALYZER_WARNING (CWE-476): bash-5.2/lib/sh/stringlist.c:160:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ bash-5.2/lib/sh/stringlist.c:35:27: note: in definition of macro ‘STRDUP’ bash-5.2/lib/sh/stringlist.c:160:19: note: in expansion of macro ‘STRDUP’ # 158| sl->list[n] = STRDUP (m1->list[i]); # 159| for (i = 0; i < l2; i++, n++) # 160|-> sl->list[n] = STRDUP (m2->list[i]); # 161| sl->list_len = n; # 162| sl->list[n] = (char *)NULL; Error: GCC_ANALYZER_WARNING (CWE-476): bash-5.2/lib/sh/stringlist.c:162:15: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ # 160| sl->list[n] = STRDUP (m2->list[i]); # 161| sl->list_len = n; # 162|-> sl->list[n] = (char *)NULL; # 163| return (sl); # 164| } Error: CPPCHECK_WARNING: bash-5.2/lib/sh/strtrans.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/strtrans.c: scope_hint: In function ‘ansicstr’ bash-5.2/lib/sh/strtrans.c:59:7: warning[-Wunused-variable]: unused variable ‘b’ # 59 | int b, mb_cur_max; # | ^ # 57| unsigned long v; # 58| size_t clen; # 59|-> int b, mb_cur_max; # 60| #if defined (HANDLE_MULTIBYTE) # 61| wchar_t wc; Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/sh/strtrans.c: scope_hint: In function ‘ansic_quote’ bash-5.2/lib/sh/strtrans.c:253:17: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 253 | for (s = str; c = *s; s++) # | ^ # 251| *r++ = '\''; # 252| # 253|-> for (s = str; c = *s; s++) # 254| { # 255| b = l = 1; /* 1 == add backslash; 0 == no backslash */ Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/sh/strtrans.c: scope_hint: In function ‘ansic_wshouldquote’ bash-5.2/lib/sh/strtrans.c:337:21: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 337 | for (wcs = wcstr; wcc = *wcs; wcs++) # | ^~~ # 335| mbstowcs (wcstr, string, slen + 1); # 336| # 337|-> for (wcs = wcstr; wcc = *wcs; wcs++) # 338| if (iswprint(wcc) == 0) # 339| { Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/sh/strtrans.c: scope_hint: In function ‘ansic_shouldquote’ bash-5.2/lib/sh/strtrans.c:360:20: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 360 | for (s = string; c = *s; s++) # | ^ # 358| return 0; # 359| # 360|-> for (s = string; c = *s; s++) # 361| { # 362| #if defined (HANDLE_MULTIBYTE) Error: CPPCHECK_WARNING: bash-5.2/lib/sh/strvis.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/strvis.c: scope_hint: In function ‘sh_strvis’ bash-5.2/lib/sh/strvis.c:126:17: warning[-Wunused-variable]: unused variable ‘c’ # 126 | unsigned char c; # | ^ # 124| char *ret; # 125| size_t retind, retsize; # 126|-> unsigned char c; # 127| DECLARE_MBSTATE; # 128| Error: CPPCHECK_WARNING: bash-5.2/lib/sh/timers.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/timers.c: scope_hint: In function ‘shtimer_select’ bash-5.2/lib/sh/timers.c:185:26: warning[-Wunused-variable]: unused variable ‘prevmask’ # 185 | sigset_t blocked_sigs, prevmask; # | ^~~~~~~~ # 183| { # 184| int r, nfd; # 185|-> sigset_t blocked_sigs, prevmask; # 186| struct timeval now, tv; # 187| fd_set readfds; Error: CPPCHECK_WARNING: bash-5.2/lib/sh/tmpfile.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/tmpfile.c:61:12: warning[-Wunused-variable]: ‘ntmpfiles’ defined but not used # 61 | static int ntmpfiles; # | ^~~~~~~~~ # 59| # 60| static char *sys_tmpdir = (char *)NULL; # 61|-> static int ntmpfiles; # 62| static int tmpnamelen = -1; # 63| static unsigned long filenum = 1L; Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/tmpfile.c:63:22: warning[-Wunused-variable]: ‘filenum’ defined but not used # 63 | static unsigned long filenum = 1L; # | ^~~~~~~ # 61| static int ntmpfiles; # 62| static int tmpnamelen = -1; # 63|-> static unsigned long filenum = 1L; # 64| # 65| static char * Error: COMPILER_WARNING (CWE-1164): bash-5.2/lib/sh/tmpfile.c: scope_hint: At top level bash-5.2/lib/sh/tmpfile.c:118:1: warning[-Wunused-function]: ‘sh_seedrand’ defined but not used # 118 | sh_seedrand () # | ^~~~~~~~~~~ # 116| # 117| static void # 118|-> sh_seedrand () # 119| { # 120| #if HAVE_RANDOM Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/tmpfile.c:140:15: warning[-Wunused-variable]: unused variable ‘sb’ # 140 | struct stat sb; # | ^~ # 138| { # 139| char *filename, *tdir, *lroot; # 140|-> struct stat sb; # 141| int r, tdlen; # 142| static int seeded = 0; Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/tmpfile.c:141:7: warning[-Wunused-variable]: unused variable ‘r’ # 141 | int r, tdlen; # | ^ # 139| char *filename, *tdir, *lroot; # 140| struct stat sb; # 141|-> int r, tdlen; # 142| static int seeded = 0; # 143| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/tmpfile.c:141:10: warning[-Wunused-but-set-variable]: variable ‘tdlen’ set but not used # 141 | int r, tdlen; # | ^~~~~ # 139| char *filename, *tdir, *lroot; # 140| struct stat sb; # 141|-> int r, tdlen; # 142| static int seeded = 0; # 143| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/tmpfile.c: scope_hint: In function ‘sh_mktmpname’ bash-5.2/lib/sh/tmpfile.c:142:14: warning[-Wunused-variable]: unused variable ‘seeded’ # 142 | static int seeded = 0; # | ^~~~~~ # 140| struct stat sb; # 141| int r, tdlen; # 142|-> static int seeded = 0; # 143| # 144| filename = (char *)xmalloc (PATH_MAX + 1); Error: CLANG_WARNING: bash-5.2/lib/sh/tmpfile.c:146:3: warning[deadcode.DeadStores]: Value stored to 'tdlen' is never read # 144| filename = (char *)xmalloc (PATH_MAX + 1); # 145| tdir = get_tmpdir (flags); # 146|-> tdlen = strlen (tdir); # 147| # 148| lroot = nameroot ? nameroot : DEFAULT_NAMEROOT; Error: CLANG_WARNING: bash-5.2/lib/sh/tmpfile.c:152:32: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 150| flags &= ~MT_TEMPLATE; # 151| # 152|-> if ((flags & MT_TEMPLATE) && strlen (nameroot) > PATH_MAX) # 153| flags &= ~MT_TEMPLATE; # 154| Error: CLANG_WARNING: bash-5.2/lib/sh/tmpfile.c:160:7: warning[security.insecureAPI.mktemp]: Call to function 'mktemp' is insecure as it always creates or uses insecure temporary file. Use 'mkstemp' instead # 158| else # 159| sprintf (filename, "%s/%s.XXXXXX", tdir, lroot); # 160|-> if (mktemp (filename) == 0) # 161| { # 162| free (filename); Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/tmpfile.c: scope_hint: In function ‘sh_mktmpfd’ bash-5.2/lib/sh/tmpfile.c:196:11: warning[-Wunused-but-set-variable]: variable ‘tdlen’ set but not used # 196 | int fd, tdlen; # | ^~~~~ # 194| { # 195| char *filename, *tdir, *lroot; # 196|-> int fd, tdlen; # 197| # 198| filename = (char *)xmalloc (PATH_MAX + 1); Error: CLANG_WARNING: bash-5.2/lib/sh/tmpfile.c:200:3: warning[deadcode.DeadStores]: Value stored to 'tdlen' is never read # 198| filename = (char *)xmalloc (PATH_MAX + 1); # 199| tdir = get_tmpdir (flags); # 200|-> tdlen = strlen (tdir); # 201| # 202| lroot = nameroot ? nameroot : DEFAULT_NAMEROOT; Error: CLANG_WARNING: bash-5.2/lib/sh/tmpfile.c:206:32: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 204| flags &= ~MT_TEMPLATE; # 205| # 206|-> if ((flags & MT_TEMPLATE) && strlen (nameroot) > PATH_MAX) # 207| flags &= ~MT_TEMPLATE; # 208| Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/tmpfile.c:271:7: warning[-Wunused-variable]: unused variable ‘fd’ # 271 | int fd, tdlen; # | ^~ # 269| { # 270| char *filename, *tdir, *lroot, *dirname; # 271|-> int fd, tdlen; # 272| # 273| #ifdef USE_MKDTEMP Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/tmpfile.c: scope_hint: In function ‘sh_mktmpdir’ bash-5.2/lib/sh/tmpfile.c:271:11: warning[-Wunused-but-set-variable]: variable ‘tdlen’ set but not used # 271 | int fd, tdlen; # | ^~~~~ # 269| { # 270| char *filename, *tdir, *lroot, *dirname; # 271|-> int fd, tdlen; # 272| # 273| #ifdef USE_MKDTEMP Error: CLANG_WARNING: bash-5.2/lib/sh/tmpfile.c:276:3: warning[deadcode.DeadStores]: Value stored to 'tdlen' is never read # 274| filename = (char *)xmalloc (PATH_MAX + 1); # 275| tdir = get_tmpdir (flags); # 276|-> tdlen = strlen (tdir); # 277| # 278| lroot = nameroot ? nameroot : DEFAULT_NAMEROOT; Error: CLANG_WARNING: bash-5.2/lib/sh/tmpfile.c:282:32: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 280| flags &= ~MT_TEMPLATE; # 281| # 282|-> if ((flags & MT_TEMPLATE) && strlen (nameroot) > PATH_MAX) # 283| flags &= ~MT_TEMPLATE; # 284| Error: CPPCHECK_WARNING: bash-5.2/lib/sh/uconvert.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/lib/sh/ufuncs.c: scope_hint: In function ‘fsleep’ bash-5.2/lib/sh/ufuncs.c:92:26: warning[-Wunused-variable]: unused variable ‘prevmask’ # 92 | sigset_t blocked_sigs, prevmask; # | ^~~~~~~~ # 90| { # 91| int e, r; # 92|-> sigset_t blocked_sigs, prevmask; # 93| #if defined (HAVE_PSELECT) # 94| struct timespec ts; Error: CPPCHECK_WARNING: bash-5.2/lib/sh/unicode.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/lib/sh/utf8.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/lib/sh/zgetline.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-476): bash-5.2/lib/sh/zgetline.c: scope_hint: In function ‘zgetline’ bash-5.2/lib/sh/zgetline.c:115:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘line’ # 113| } # 114| # 115|-> line[nr] = c; # 116| nr++; # 117| Error: CLANG_WARNING: bash-5.2/lib/sh/zmapfd.c:59:3: warning[deadcode.DeadStores]: Value stored to 'rval' is never read # 57| size_t rsize, rind; # 58| # 59|-> rval = 0; # 60| result = (char *)xmalloc (rsize = ZBUFSIZ); # 61| rind = 0; Error: CPPCHECK_WARNING: bash-5.2/lib/tilde/tilde.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/lib/tilde/tilde.c:194:18: warning[deadcode.DeadStores]: Although the value stored to 'result_size' is used in the enclosing expression, the value is never actually read from 'result_size' # 192| int result_size, result_index; # 193| # 194|-> result_index = result_size = 0; # 195| if (result = strchr (string, '~')) # 196| result = (char *)xmalloc (result_size = (strlen (string) + 16)); Error: COMPILER_WARNING (CWE-569): bash-5.2/lib/tilde/tilde.c: scope_hint: In function ‘tilde_expand’ bash-5.2/lib/tilde/tilde.c:195:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 195 | if (result = strchr (string, '~')) # | ^~~~~~ # 193| # 194| result_index = result_size = 0; # 195|-> if (result = strchr (string, '~')) # 196| result = (char *)xmalloc (result_size = (strlen (string) + 16)); # 197| else Error: CLANG_WARNING: bash-5.2/lib/tilde/tilde.c:195:7: warning[deadcode.DeadStores]: Although the value stored to 'result' is used in the enclosing expression, the value is never actually read from 'result' # 193| # 194| result_index = result_size = 0; # 195|-> if (result = strchr (string, '~')) # 196| result = (char *)xmalloc (result_size = (strlen (string) + 16)); # 197| else Error: CPPCHECK_WARNING: bash-5.2/locale.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/locale.c: scope_hint: In function ‘reset_locale_vars’ bash-5.2/locale.c:363:9: warning[-Wunused-but-set-variable]: variable ‘t’ set but not used # 363 | char *t, *x; # | ^ # 361| reset_locale_vars () # 362| { # 363|-> char *t, *x; # 364| #if defined (HAVE_SETLOCALE) # 365| if (lang == 0 || *lang == '\0') Error: CLANG_WARNING: bash-5.2/locale.c:375:3: warning[deadcode.DeadStores]: Value stored to 't' is never read # 373| # endif # 374| # if defined (LC_COLLATE) # 375|-> t = setlocale (LC_COLLATE, get_locale_var ("LC_COLLATE")); # 376| # endif # 377| # if defined (LC_MESSAGES) Error: CLANG_WARNING: bash-5.2/locale.c:378:3: warning[deadcode.DeadStores]: Value stored to 't' is never read # 376| # endif # 377| # if defined (LC_MESSAGES) # 378|-> t = setlocale (LC_MESSAGES, get_locale_var ("LC_MESSAGES")); # 379| # endif # 380| # if defined (LC_NUMERIC) Error: CLANG_WARNING: bash-5.2/locale.c:381:3: warning[deadcode.DeadStores]: Value stored to 't' is never read # 379| # endif # 380| # if defined (LC_NUMERIC) # 381|-> t = setlocale (LC_NUMERIC, get_locale_var ("LC_NUMERIC")); # 382| # endif # 383| # if defined (LC_TIME) Error: CLANG_WARNING: bash-5.2/locale.c:384:3: warning[deadcode.DeadStores]: Value stored to 't' is never read # 382| # endif # 383| # if defined (LC_TIME) # 384|-> t = setlocale (LC_TIME, get_locale_var ("LC_TIME")); # 385| # endif # 386| Error: COMPILER_WARNING (CWE-563): bash-5.2/locale.c: scope_hint: In function ‘locale_isutf8’ bash-5.2/locale.c:599:14: warning[-Wunused-variable]: unused variable ‘encoding’ # 599 | char *cp, *encoding; # | ^~~~~~~~ # 597| char *lspec; # 598| { # 599|-> char *cp, *encoding; # 600| # 601| #if HAVE_LANGINFO_CODESET Error: GCC_ANALYZER_WARNING (CWE-476): bash-5.2/shell.h:29: included_from: Included from here. bash-5.2/mailcheck.c:36: included_from: Included from here. bash-5.2/mailcheck.c: scope_hint: In function ‘find_mail_file’ bash-5.2/mailcheck.c:121:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘mailfiles’ bash-5.2/general.h:166:23: note: in definition of macro ‘STREQ’ bash-5.2/general.h:166:23: note: in definition of macro ‘STREQ’ bash-5.2/general.h:166:23: note: in definition of macro ‘STREQ’ # 119| # 120| for (i = 0; i < mailfiles_count; i++) # 121|-> if (STREQ (mailfiles[i]->name, file)) # 122| return i; # 123| Error: COMPILER_WARNING (CWE-569): bash-5.2/mailcheck.c: scope_hint: In function ‘remember_mail_dates’ bash-5.2/mailcheck.c:394:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 394 | while (mailfile = extract_colon_unit (mailpaths, &i)) # | ^~~~~~~~ # 392| } # 393| # 394|-> while (mailfile = extract_colon_unit (mailpaths, &i)) # 395| { # 396| mp = parse_mailpath_spec (mailfile); Error: COMPILER_WARNING (CWE-569): bash-5.2/mailcheck.c: scope_hint: In function ‘check_mail’ bash-5.2/mailcheck.c:468:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 468 | if (temp = expand_string_to_string (message, Q_DOUBLE_QUOTES)) # | ^~~~ # 466| #undef mtime # 467| # 468|-> if (temp = expand_string_to_string (message, Q_DOUBLE_QUOTES)) # 469| { # 470| puts (temp); Error: CPPCHECK_WARNING: bash-5.2/make_cmd.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/make_cmd.c:280:3: warning[deadcode.DeadStores]: Value stored to 'start' is never read # 278| init = test = step = (WORD_LIST *)NULL; # 279| /* Parse the string into the three component sub-expressions. */ # 280|-> start = t = s = exprs->word->word; # 281| for (nsemi = 0; ;) # 282| { Error: CLANG_WARNING: bash-5.2/make_cmd.c:280:11: warning[deadcode.DeadStores]: Although the value stored to 't' is used in the enclosing expression, the value is never actually read from 't' # 278| init = test = step = (WORD_LIST *)NULL; # 279| /* Parse the string into the three component sub-expressions. */ # 280|-> start = t = s = exprs->word->word; # 281| for (nsemi = 0; ;) # 282| { Error: COMPILER_WARNING (CWE-569): bash-5.2/make_cmd.c: scope_hint: In function ‘make_here_document’ bash-5.2/make_cmd.c:616:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 616 | while (full_line = read_secondary_line (delim_unquoted)) # | ^~~~~~~~~ # 614| be read verbatim from the input. If it was not quoted, we # 615| need to perform backslash-quoted newline removal. */ # 616|-> while (full_line = read_secondary_line (delim_unquoted)) # 617| { # 618| register char *line; Error: CPPCHECK_WARNING: bash-5.2/mksyntax.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/mksyntax.c:345:3: warning[deadcode.DeadStores]: Value stored to 'argc' is never read # 343| } # 344| # 345|-> argc -= optind; # 346| argv += optind; # 347| Error: CLANG_WARNING: bash-5.2/mksyntax.c:346:3: warning[deadcode.DeadStores]: Value stored to 'argv' is never read # 344| # 345| argc -= optind; # 346|-> argv += optind; # 347| # 348| if (filename) Error: CLANG_WARNING: bash-5.2/mksyntax.c:359:7: warning[deadcode.DeadStores]: Value stored to 'filename' is never read # 357| else # 358| { # 359|-> filename = "stdout"; # 360| fp = stdout; # 361| } Error: COMPILER_WARNING (CWE-563): bash-5.2/parse.y:315:12: warning[-Wunused-variable]: ‘global_extglob’ defined but not used # 315 | static int global_extglob; # | ^~~~~~~~~~~~~~ # 313| static int two_tokens_ago; # 314| # 315|-> static int global_extglob; # 316| # 317| /* The line number in a script where the word in a `case WORD', `select WORD' Error: COMPILER_WARNING (CWE-563): bash-5.2/parse.y:334:14: warning[-Wunused-variable]: ‘yyoutstream’ defined but not used # 334 | static FILE *yyoutstream; # | ^~~~~~~~~~~ # 332| static REDIRECTEE redir; # 333| # 334|-> static FILE *yyoutstream; # 335| static FILE *yyerrstream; # 336| %} Error: COMPILER_WARNING (CWE-563): bash-5.2/parse.y:335:14: warning[-Wunused-variable]: ‘yyerrstream’ defined but not used # 335 | static FILE *yyerrstream; # | ^~~~~~~~~~~ # 333| # 334| static FILE *yyoutstream; # 335|-> static FILE *yyerrstream; # 336| %} # 337| Error: COMPILER_WARNING (CWE-563): bash-5.2/parse.y:2175:7: warning[-Wunused-variable]: unused variable ‘n’ # 2175 | int n, c; # | ^ # 2173| { # 2174| char *ret; # 2175|-> int n, c; # 2176| # 2177| prompt_string_pointer = &ps2_prompt; Error: COMPILER_WARNING (CWE-563): bash-5.2/parse.y: scope_hint: In function ‘read_secondary_line’ bash-5.2/parse.y:2175:10: warning[-Wunused-variable]: unused variable ‘c’ # 2175 | int n, c; # | ^ # 2173| { # 2174| char *ret; # 2175|-> int n, c; # 2176| # 2177| prompt_string_pointer = &ps2_prompt; Error: COMPILER_WARNING (CWE-563): bash-5.2/parse.y: scope_hint: In function ‘parse_matched_pair’ bash-5.2/parse.y:3680:18: warning[-Wunused-but-set-variable]: variable ‘prevch’ set but not used # 3680 | int count, ch, prevch, tflags; # | ^~~~~~ # 3678| int *lenp, flags; # 3679| { # 3680|-> int count, ch, prevch, tflags; # 3681| int nestlen, ttranslen, start_lineno; # 3682| char *ret, *nestret, *ttrans; Error: COMPILER_WARNING (CWE-563): bash-5.2/parse.y: scope_hint: In function ‘parse_comsub’ bash-5.2/parse.y:4089:7: warning[-Wunused-but-set-variable]: variable ‘start_lineno’ set but not used # 4089 | int start_lineno, local_extglob, was_extpat; # | ^~~~~~~~~~~~ # 4087| { # 4088| int peekc, r; # 4089|-> int start_lineno, local_extglob, was_extpat; # 4090| char *ret, *tcmd; # 4091| int retlen; Error: COMPILER_WARNING (CWE-457): bash-5.2/parse.y: scope_hint: In function ‘parse_comsub.constprop.0’ bash-5.2/parse.y:4165:19: warning[-Wmaybe-uninitialized]: ‘local_extglob’ may be used uninitialized # 4165 | extended_glob = local_extglob; # | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ bash-5.2/parse.y:4089:21: note: ‘local_extglob’ was declared here # 4089 | int start_lineno, local_extglob, was_extpat; # | ^~~~~~~~~~~~~ # 4163| #if defined (EXTENDED_GLOB) # 4164| if (shell_compatibility_level <= 51 && was_extpat == 0) # 4165|-> extended_glob = local_extglob; # 4166| #endif # 4167| Error: COMPILER_WARNING (CWE-563): bash-5.2/parse.y: scope_hint: In function ‘xparse_dolparen’ bash-5.2/parse.y:4256:7: warning[-Wunused-but-set-variable]: variable ‘orig_ind’ set but not used # 4256 | int orig_ind, nc, sflags, start_lineno, local_extglob; # | ^~~~~~~~ # 4254| sh_parser_state_t ps; # 4255| sh_input_line_state_t ls; # 4256|-> int orig_ind, nc, sflags, start_lineno, local_extglob; # 4257| char *ret, *ep, *ostring; # 4258| Error: COMPILER_WARNING (CWE-563): bash-5.2/parse.y: scope_hint: In function ‘parse_string_to_command’ bash-5.2/parse.y:4395:9: warning[-Wunused-variable]: unused variable ‘ret’ # 4395 | char *ret, *ep; # | ^~~ # 4393| int nc, sflags; # 4394| size_t slen; # 4395|-> char *ret, *ep; # 4396| COMMAND *cmd; # 4397| Error: COMPILER_WARNING (CWE-563): bash-5.2/parse.y: scope_hint: In function ‘parse_dparen’ bash-5.2/parse.y:4461:15: warning[-Wunused-but-set-variable]: variable ‘sline’ set but not used # 4461 | int cmdtyp, sline; # | ^~~~~ # 4459| int c; # 4460| { # 4461|-> int cmdtyp, sline; # 4462| char *wval; # 4463| WORD_DESC *wd; Error: COMPILER_WARNING (CWE-563): bash-5.2/parse.y: scope_hint: In function ‘parse_arith_cmd’ bash-5.2/parse.y:4524:7: warning[-Wunused-but-set-variable]: variable ‘exp_lineno’ set but not used # 4524 | int exp_lineno, rval, c; # | ^~~~~~~~~~ # 4522| int adddq; # 4523| { # 4524|-> int exp_lineno, rval, c; # 4525| char *ttok, *tokstr; # 4526| int ttoklen; Error: COMPILER_WARNING (CWE-569): bash-5.2/parse.y: scope_hint: In function ‘cond_error’ bash-5.2/parse.y:4579:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 4579 | if (etext = error_token_from_token (cond_token)) # | ^~~~~ # 4577| else if (cond_token != COND_ERROR) # 4578| { # 4579|-> if (etext = error_token_from_token (cond_token)) # 4580| { # 4581| parser_error (cond_lineno, _("syntax error in conditional expression: unexpected token `%s'"), etext); Error: COMPILER_WARNING (CWE-569): bash-5.2/parse.y: scope_hint: In function ‘cond_term’ bash-5.2/parse.y:4661:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 4661 | if (etext = error_token_from_token (cond_token)) # | ^~~~~ # 4659| if (term) # 4660| dispose_cond_node (term); /* ( */ # 4661|-> if (etext = error_token_from_token (cond_token)) # 4662| { # 4663| parser_error (lineno, _("unexpected token `%s', expected `)'"), etext); Error: COMPILER_WARNING (CWE-569): bash-5.2/parse.y:4693:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 4693 | if (etext = error_token_from_token (tok)) # | ^~~~~ # 4691| { # 4692| dispose_word (op); # 4693|-> if (etext = error_token_from_token (tok)) # 4694| { # 4695| parser_error (line_number, _("unexpected argument `%s' to conditional unary operator"), etext); Error: COMPILER_WARNING (CWE-569): bash-5.2/parse.y:4744:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 4744 | if (etext = error_token_from_token (tok)) # | ^~~~~ # 4742| else # 4743| { # 4744|-> if (etext = error_token_from_token (tok)) # 4745| { # 4746| parser_error (line_number, _("unexpected token `%s', conditional binary operator expected"), etext); Error: COMPILER_WARNING (CWE-569): bash-5.2/parse.y:4775:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 4775 | if (etext = error_token_from_token (tok)) # | ^~~~~ # 4773| else # 4774| { # 4775|-> if (etext = error_token_from_token (tok)) # 4776| { # 4777| parser_error (line_number, _("unexpected argument `%s' to conditional binary operator"), etext); Error: COMPILER_WARNING (CWE-569): bash-5.2/parse.y:4793:16: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 4793 | else if (etext = error_token_from_token (tok)) # | ^~~~~ # 4791| if (tok < 256) # 4792| parser_error (line_number, _("unexpected token `%c' in conditional command"), tok); # 4793|-> else if (etext = error_token_from_token (tok)) # 4794| { # 4795| parser_error (line_number, _("unexpected token `%s' in conditional command"), etext); Error: CPPCHECK_WARNING (CWE-457): bash-5.2/parse.y:4802: error[legacyUninitvar]: Uninitialized variable: term # 4800| COND_RETURN_ERROR (); # 4801| } # 4802|-> return (term); # 4803| } # 4804| Error: COMPILER_WARNING (CWE-569): bash-5.2/parse.y: scope_hint: In function ‘decode_prompt_string’ bash-5.2/parse.y:5722:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 5722 | while (c = *string++) # | ^ # 5720| orig_string = string; # 5721| # 5722|-> while (c = *string++) # 5723| { # 5724| if (posixly_correct && c == '!') Error: COMPILER_WARNING (CWE-569): bash-5.2/parse.y: scope_hint: In function ‘error_token_from_token’ bash-5.2/parse.y:6138:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 6138 | if (t = find_token_in_alist (tok, word_token_alist, 0)) # | ^ # 6136| char *t; # 6137| # 6138|-> if (t = find_token_in_alist (tok, word_token_alist, 0)) # 6139| return t; # 6140| Error: COMPILER_WARNING (CWE-569): bash-5.2/parse.y:6141:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 6141 | if (t = find_token_in_alist (tok, other_token_alist, 0)) # | ^ # 6139| return t; # 6140| # 6141|-> if (t = find_token_in_alist (tok, other_token_alist, 0)) # 6142| return t; # 6143| Error: COMPILER_WARNING (CWE-1164): bash-5.2/parse.y: scope_hint: At top level bash-5.2/parse.y:6314:1: warning[-Wunused-function]: ‘discard_parser_constructs’ defined but not used # 6314 | discard_parser_constructs (error_p) # | ^~~~~~~~~~~~~~~~~~~~~~~~~ # 6312| (dispose_command () will actually free the command.) */ # 6313| static void # 6314|-> discard_parser_constructs (error_p) # 6315| int error_p; # 6316| { Error: COMPILER_WARNING (CWE-569): bash-5.2/parse.y: scope_hint: In function ‘parse_string_to_word_list’ bash-5.2/parse.y:6417:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 6417 | if (ea = expanding_alias ()) # | ^~ # 6415| # 6416| push_stream (1); # 6417|-> if (ea = expanding_alias ()) # 6418| parser_save_alias (); # 6419| Error: COMPILER_WARNING (CWE-563): bash-5.2/parse.y: scope_hint: In function ‘restore_parser_state’ bash-5.2/parse.y:6638:7: warning[-Wunused-variable]: unused variable ‘i’ # 6638 | int i; # | ^ # 6636| sh_parser_state_t *ps; # 6637| { # 6638|-> int i; # 6639| # 6640| if (ps == 0) Error: CPPCHECK_WARNING: bash-5.2/pathexp.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/pathexp.c:70:10: warning[deadcode.DeadStores]: Although the value stored to 'bsquote' is used in the enclosing expression, the value is never actually read from 'bsquote' # 68| DECLARE_MBSTATE; # 69| # 70|-> open = bsquote = 0; # 71| send = string + strlen (string); # 72| Error: COMPILER_WARNING (CWE-569): bash-5.2/pathexp.c: scope_hint: In function ‘unquoted_glob_pattern_p’ bash-5.2/pathexp.c:73:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 73 | while (c = *string++) # | ^ # 71| send = string + strlen (string); # 72| # 73|-> while (c = *string++) # 74| { # 75| switch (c) Error: CLANG_WARNING: bash-5.2/pathexp.c:107:8: warning[deadcode.DeadStores]: Value stored to 'bsquote' is never read # 105| if (*string != '\0' && *string != '/') # 106| { # 107|-> bsquote = 1; # 108| string++; # 109| continue; Error: CLANG_WARNING: bash-5.2/pathexp.c:223:30: warning[deadcode.DeadStores]: Although the value stored to 'last_was_backslash' is used in the enclosing expression, the value is never actually read from 'last_was_backslash' # 221| } # 222| # 223|-> cclass = collsym = equiv = last_was_backslash = 0; # 224| for (i = j = 0; pathname[i]; i++) # 225| { Error: CLANG_WARNING: bash-5.2/pathexp.c:370:9: warning[deadcode.DeadStores]: Value stored to 'last_was_backslash' is never read # 368| } # 369| else if (pathname[i] == '\\' && (qflags & QGLOB_REGEXP)) # 370|-> last_was_backslash = 1; # 371| temp[j++] = pathname[i]; # 372| } Error: COMPILER_WARNING (CWE-563): bash-5.2/pathexp.c: scope_hint: In function ‘shell_glob_filename’ bash-5.2/pathexp.c:412:15: warning[-Wunused-variable]: unused variable ‘quoted_pattern’ # 412 | int gflags, quoted_pattern; # | ^~~~~~~~~~~~~~ # 410| { # 411| char *temp, **results; # 412|-> int gflags, quoted_pattern; # 413| # 414| noglob_dot_filenames = glob_dot_filenames == 0; Error: COMPILER_WARNING (CWE-569): bash-5.2/pathexp.c: scope_hint: In function ‘setup_ignore_patterns’ bash-5.2/pathexp.c:620:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 620 | while (colon_bit = split_ignorespec (this_ignoreval, &ptr)) # | ^~~~~~~~~ # 618| while (colon_bit = extract_colon_unit (this_ignoreval, &ptr)) # 619| #else # 620|-> while (colon_bit = split_ignorespec (this_ignoreval, &ptr)) # 621| #endif # 622| { Error: CLANG_WARNING: bash-5.2/pcomplete.c:792:8: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 790| dfn = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character); # 791| else # 792|-> dfn = savestring (text); # 793| } # 794| Error: CLANG_WARNING: bash-5.2/pcomplete.c:1024:7: warning[deadcode.DeadStores]: Value stored to 'v' is never read # 1022| { # 1023| #ifdef ARRAY_VARS # 1024|-> v = bind_comp_words (lwords); # 1025| value = inttostr (cw, ibuf, sizeof(ibuf)); # 1026| bind_int_variable ("COMP_CWORD", value, 0); Error: CLANG_WARNING: bash-5.2/pcomplib.c:187:3: warning[core.NullDereference]: Access to field 'refcount' results in a dereference of a null pointer (loaded from variable 'cs') # 185| progcomp_create (); # 186| # 187|-> cs->refcount++; # 188| item = hash_insert (cmd, prog_completes, 0); # 189| if (item->data) Error: CPPCHECK_WARNING: bash-5.2/print_cmd.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING: bash-5.2/print_cmd.c: scope_hint: In function ‘make_command_string_internal’ bash-5.2/print_cmd.c:189:14: warning[-Wformat-zero-length]: zero-length gnu_printf format string # 189 | cprintf (""); # | ^~ # 187| # 188| if (command == 0) # 189|-> cprintf (""); # 190| else # 191| { Error: COMPILER_WARNING (CWE-1164): bash-5.2/print_cmd.c: scope_hint: At top level bash-5.2/print_cmd.c:1004:1: warning[-Wunused-function]: ‘print_heredocs’ defined but not used # 1004 | print_heredocs (heredocs) # | ^~~~~~~~~~~~~~ # 1002| # 1003| static void # 1004|-> print_heredocs (heredocs) # 1005| REDIRECT *heredocs; # 1006| { Error: COMPILER_WARNING (CWE-563): bash-5.2/print_cmd.c: scope_hint: In function ‘print_redirection_list’ bash-5.2/print_cmd.c:1063:9: warning[-Wunused-variable]: unused variable ‘rw’ # 1063 | char *rw; # | ^~ # 1061| { # 1062| REDIRECT *heredocs, *hdtail, *newredir; # 1063|-> char *rw; # 1064| # 1065| heredocs = (REDIRECT *)NULL; Error: CLANG_WARNING: bash-5.2/quit.h:36:3: note: expanded from macro 'QUIT' # 34| end up exiting the shell. */ # 35| #define QUIT \ # 36|-> do { \ # 37| if (terminating_signal) termsig_handler (terminating_signal); \ # 38| if (interrupt_state) throw_to_top_level (); \ Error: CLANG_WARNING: bash-5.2/quit.h:37:5: note: expanded from macro 'QUIT' # 35| #define QUIT \ # 36| do { \ # 37|-> if (terminating_signal) termsig_handler (terminating_signal); \ # 38| if (interrupt_state) throw_to_top_level (); \ # 39| } while (0) Error: CLANG_WARNING: bash-5.2/quit.h:37:9: note: expanded from macro 'QUIT' # 35| #define QUIT \ # 36| do { \ # 37|-> if (terminating_signal) termsig_handler (terminating_signal); \ # 38| if (interrupt_state) throw_to_top_level (); \ # 39| } while (0) Error: CLANG_WARNING: bash-5.2/quit.h:38:5: note: expanded from macro 'QUIT' # 36| do { \ # 37| if (terminating_signal) termsig_handler (terminating_signal); \ # 38|-> if (interrupt_state) throw_to_top_level (); \ # 39| } while (0) # 40| Error: CLANG_WARNING: bash-5.2/quit.h:38:9: note: expanded from macro 'QUIT' # 36| do { \ # 37| if (terminating_signal) termsig_handler (terminating_signal); \ # 38|-> if (interrupt_state) throw_to_top_level (); \ # 39| } while (0) # 40| Error: CLANG_WARNING: bash-5.2/quit.h:47:21: note: expanded from macro 'ISINTERRUPT' # 45| #define DELINTERRUPT interrupt_state-- # 46| # 47|-> #define ISINTERRUPT interrupt_state != 0 # 48| # 49| /* The same sort of thing, this time just for signals that would ordinarily Error: CPPCHECK_WARNING: bash-5.2/redir.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-775): bash-5.2/redir.c: scope_hint: In function ‘do_redirection_internal’ bash-5.2/redir.c:365:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘here_document_to_fd(redirectee, ri)’ # 363| int old; # 364| # 365|-> if (redirectee->word == 0 || redirectee->word[0] == '\0') # 366| { # 367| if (lenp) Error: CLANG_WARNING: bash-5.2/redir.c:519:11: warning[deadcode.DeadStores]: Although the value stored to 'r' is used in the enclosing expression, the value is never actually read from 'r' # 517| SET_CLOSE_ON_EXEC (fd); # 518| # 519|-> errno = r = 0; /* XXX */ # 520| r = heredoc_write (fd, document, document_len); # 521| if (document != redirectee->word) Error: COMPILER_WARNING (CWE-1164): bash-5.2/redir.c: scope_hint: At top level bash-5.2/redir.c:767:1: warning[-Wunused-function]: ‘undoablefd’ defined but not used # 767 | undoablefd (fd) # | ^~~~~~~~~~ # 765| # 766| static int # 767|-> undoablefd (fd) # 768| int fd; # 769| { Error: GCC_ANALYZER_WARNING (CWE-457): bash-5.2/redir.c:872:23: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘new_redirect’ # 870| /* Set up the variables needed by the rest of the function from the # 871| new redirection. */ # 872|-> if (new_redirect->instruction == r_err_and_out) # 873| { # 874| char *alloca_hack; Error: COMPILER_WARNING (CWE-457): bash-5.2/redir.c: scope_hint: In function ‘do_redirection_internal.constprop.0’ bash-5.2/redir.c:872:23: warning[-Wmaybe-uninitialized]: ‘new_redirect’ may be used uninitialized # 872 | if (new_redirect->instruction == r_err_and_out) # | ~~~~~~~~~~~~^~~~~~~~~~~~~ bash-5.2/redir.c:797:13: note: ‘new_redirect’ was declared here # 797 | REDIRECT *new_redirect; # | ^~~~~~~~~~~~ # 870| /* Set up the variables needed by the rest of the function from the # 871| new redirection. */ # 872|-> if (new_redirect->instruction == r_err_and_out) # 873| { # 874| char *alloca_hack; Error: CLANG_WARNING: bash-5.2/redir.c:917:20: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 915| redirectee_word = redirection_expand (redirectee); # 916| if (posixly_correct && interactive_shell == 0) # 917|-> redirectee->flags = oflags; # 918| # 919| if (redirectee_word == 0) Error: GCC_ANALYZER_WARNING (CWE-457): bash-5.2/redir.c:917:27: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘oflags’ # 915| redirectee_word = redirection_expand (redirectee); # 916| if (posixly_correct && interactive_shell == 0) # 917|-> redirectee->flags = oflags; # 918| # 919| if (redirectee_word == 0) Error: COMPILER_WARNING (CWE-457): bash-5.2/redir.c:917:27: warning[-Wmaybe-uninitialized]: ‘oflags’ may be used uninitialized # 917 | redirectee->flags = oflags; # | ~~~~~~~~~~~~~~~~~~^~~~~~~~ bash-5.2/redir.c:793:36: note: ‘oflags’ was declared here # 793 | int redir_fd, fd, redirector, r, oflags; # | ^~~~~~ # 915| redirectee_word = redirection_expand (redirectee); # 916| if (posixly_correct && interactive_shell == 0) # 917|-> redirectee->flags = oflags; # 918| # 919| if (redirectee_word == 0) Error: GCC_ANALYZER_WARNING (CWE-775): bash-5.2/redir.c:997:39: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(redir_open(redirection_expand(redirectee), *redirect.flags, 438, ri), redirector)’ bash-5.2/redir.c: scope_hint: In function ‘do_redirection_internal’ # 995| } # 996| } # 997|-> else if ((fd != redirector) && (dup2 (fd, redirector) < 0)) # 998| { # 999| close (fd); /* dup2 failed? must be fd limit issue */ Error: GCC_ANALYZER_WARNING (CWE-775): bash-5.2/redir.c:1101:41: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(here_document_to_fd(redirectee, ri), redirector)’ # 1099| } # 1100| } # 1101|-> else if (fd != redirector && dup2 (fd, redirector) < 0) # 1102| { # 1103| r = errno; Error: GCC_ANALYZER_WARNING (CWE-775): bash-5.2/redir.c:1177:19: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(redir_fd, redirector)’ # 1175| } # 1176| /* This is correct. 2>&1 means dup2 (1, 2); */ # 1177|-> else if (dup2 (redir_fd, redirector) < 0) # 1178| return (errno); # 1179| Error: CLANG_WARNING: bash-5.2/redir.c:1235:4: warning[deadcode.DeadStores]: Value stored to 'r' is never read # 1233| } # 1234| # 1235|-> r = 0; # 1236| if (flags & RX_UNDOABLE) # 1237| { Error: COMPILER_WARNING (CWE-569): bash-5.2/redir.c: scope_hint: In function ‘redir_varvalue’ bash-5.2/redir.c:1485:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 1485 | if (vr = valid_array_reference (w, 0)) # | ^~ # 1483| /* XXX - handle set -u here? */ # 1484| #if defined (ARRAY_VARS) # 1485|-> if (vr = valid_array_reference (w, 0)) # 1486| { # 1487| v = array_variable_part (w, 0, &sub, &len); Error: COMPILER_WARNING (CWE-569): bash-5.2/redir.c:1500:19: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 1500 | if (vr = valid_array_reference (w, 0)) # | ^~ # 1498| { # 1499| w = nameref_cell (v); # 1500|-> if (vr = valid_array_reference (w, 0)) # 1501| v = array_variable_part (w, 0, &sub, &len); # 1502| else Error: CPPCHECK_WARNING: bash-5.2/shell.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/shell.c:731:19: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 729| { # 730| free (dollar_vars[0]); # 731|-> dollar_vars[0] = t; # 732| } # 733| exit_immediately_on_error += old_errexit_flag; Error: COMPILER_WARNING (CWE-569): bash-5.2/shell.c: scope_hint: In function ‘parse_shell_options’ bash-5.2/shell.c:928:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 928 | while (arg_character = arg_string[i++]) # | ^~~~~~~~~~~~~ # 926| i = 1; # 927| on_or_off = arg_string[0]; # 928|-> while (arg_character = arg_string[i++]) # 929| { # 930| switch (arg_character) Error: COMPILER_WARNING (CWE-563): bash-5.2/shell.c: scope_hint: In function ‘disable_priv_mode’ bash-5.2/shell.c:1351:7: warning[-Wunused-but-set-variable]: variable ‘e’ set but not used # 1351 | int e; # | ^ # 1349| disable_priv_mode () # 1350| { # 1351|-> int e; # 1352| # 1353| #if HAVE_SETRESUID Error: CLANG_WARNING: bash-5.2/shell.c:1359:7: warning[deadcode.DeadStores]: Value stored to 'e' is never read # 1357| #endif # 1358| { # 1359|-> e = errno; # 1360| sys_error (_("cannot set uid to %d: effective uid %d"), current_user.uid, current_user.euid); # 1361| #if defined (EXIT_ON_SETUID_FAILURE) Error: CLANG_WARNING: bash-5.2/shell.c:1824:20: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull' # 1822| shell_name = argv0 ? argv0 : PROGRAM; # 1823| FREE (dollar_vars[0]); # 1824|-> dollar_vars[0] = savestring (shell_name); # 1825| # 1826| /* A program may start an interactive shell with Error: CPPCHECK_WARNING: bash-5.2/sig.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING (CWE-476): bash-5.2/sig.c:667: error[nullPointer]: Null pointer dereference: (volatile unsigned long*)((void*)0) # 665| # 666| if (core) # 667|-> *((volatile unsigned long *) NULL) = 0xdead0000 + sig; /* SIGSEGV */ # 668| # 669| exit (128+sig); Error: GCC_ANALYZER_WARNING (CWE-476): bash-5.2/sig.c: scope_hint: In function ‘kill_shell’ bash-5.2/sig.c:667:40: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ # 665| # 666| if (core) # 667|-> *((volatile unsigned long *) NULL) = 0xdead0000 + sig; /* SIGSEGV */ # 668| # 669| exit (128+sig); Error: CPPCHECK_WARNING: bash-5.2/stringlib.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: bash-5.2/stringlib.c:59:12: warning[deadcode.DeadStores]: Although the value stored to 'r' is used in the enclosing expression, the value is never actually read from 'r' # 57| int r; # 58| # 59|-> for (i = r = 0; alist[i].word; i++) # 60| { # 61| #if defined (EXTENDED_GLOB) Error: CLANG_WARNING: bash-5.2/stringlib.c:102:12: warning[deadcode.DeadStores]: Although the value stored to 'r' is used in the enclosing expression, the value is never actually read from 'r' # 100| int r; # 101| # 102|-> for (i = r = 0; alist[i].word; i++) # 103| { # 104| #if defined (EXTENDED_GLOB) Error: CLANG_WARNING: bash-5.2/stringlib.c:163:22: warning[core.NullDereference]: Array access (from variable 'temp') results in a null pointer dereference # 161| # 162| for (r = rep; *r; ) /* can rep == "" */ # 163|-> temp[templen++] = *r++; # 164| # 165| i += patlen ? patlen : 1; /* avoid infinite recursion */ Error: GCC_ANALYZER_WARNING (CWE-476): bash-5.2/stringlib.c: scope_hint: In function ‘strsub’ bash-5.2/stringlib.c:163:29: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘temp’ # 161| # 162| for (r = rep; *r; ) /* can rep == "" */ # 163|-> temp[templen++] = *r++; # 164| # 165| i += patlen ? patlen : 1; /* avoid infinite recursion */ Error: CPPCHECK_WARNING: bash-5.2/subst.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/subst.c:222:53: warning[-Wunused-variable]: ‘expand_param_unset’ defined but not used # 222 | static char expand_param_error, expand_param_fatal, expand_param_unset; # | ^~~~~~~~~~~~~~~~~~ # 220| static WORD_LIST expand_word_error, expand_word_fatal; # 221| static WORD_DESC expand_wdesc_error, expand_wdesc_fatal; # 222|-> static char expand_param_error, expand_param_fatal, expand_param_unset; # 223| static char extract_string_error, extract_string_fatal; # 224| Error: COMPILER_WARNING (CWE-1164): bash-5.2/subst.c: scope_hint: At top level bash-5.2/subst.c:236:14: warning[-Wunused-function]: ‘quoted_substring’ declared ‘static’ but never defined # 236 | static char *quoted_substring PARAMS((char *, int, int)); # | ^~~~~~~~~~~~~~~~ # 234| static WORD_LIST *garglist = (WORD_LIST *)NULL; # 235| # 236|-> static char *quoted_substring PARAMS((char *, int, int)); # 237| static int quoted_strlen PARAMS((char *)); # 238| static char *quoted_strchr PARAMS((char *, int, int)); Error: COMPILER_WARNING (CWE-1164): bash-5.2/subst.c:237:12: warning[-Wunused-function]: ‘quoted_strlen’ declared ‘static’ but never defined # 237 | static int quoted_strlen PARAMS((char *)); # | ^~~~~~~~~~~~~ # 235| # 236| static char *quoted_substring PARAMS((char *, int, int)); # 237|-> static int quoted_strlen PARAMS((char *)); # 238| static char *quoted_strchr PARAMS((char *, int, int)); # 239| Error: COMPILER_WARNING (CWE-1164): bash-5.2/subst.c:238:14: warning[-Wunused-function]: ‘quoted_strchr’ declared ‘static’ but never defined # 238 | static char *quoted_strchr PARAMS((char *, int, int)); # | ^~~~~~~~~~~~~ # 236| static char *quoted_substring PARAMS((char *, int, int)); # 237| static int quoted_strlen PARAMS((char *)); # 238|-> static char *quoted_strchr PARAMS((char *, int, int)); # 239| # 240| static char *expand_string_if_necessary PARAMS((char *, int, EXPFUNC *)); Error: COMPILER_WARNING (CWE-1164): bash-5.2/subst.c:251:19: warning[-Wunused-function]: ‘list_dequote_escapes’ declared ‘static’ but never defined # 251 | static WORD_LIST *list_dequote_escapes PARAMS((WORD_LIST *)); # | ^~~~~~~~~~~~~~~~~~~~ # 249| # 250| static WORD_LIST *list_quote_escapes PARAMS((WORD_LIST *)); # 251|-> static WORD_LIST *list_dequote_escapes PARAMS((WORD_LIST *)); # 252| # 253| static char *make_quoted_char PARAMS((int)); Error: COMPILER_WARNING (CWE-1164): bash-5.2/subst.c:256:12: warning[-Wunused-function]: ‘unquoted_substring’ declared ‘static’ but never defined # 256 | static int unquoted_substring PARAMS((char *, char *)); # | ^~~~~~~~~~~~~~~~~~ # 254| static WORD_LIST *quote_list PARAMS((WORD_LIST *)); # 255| # 256|-> static int unquoted_substring PARAMS((char *, char *)); # 257| static int unquoted_member PARAMS((int, char *)); # 258| Error: COMPILER_WARNING (CWE-1164): bash-5.2/subst.c:257:12: warning[-Wunused-function]: ‘unquoted_member’ declared ‘static’ but never defined # 257 | static int unquoted_member PARAMS((int, char *)); # | ^~~~~~~~~~~~~~~ # 255| # 256| static int unquoted_substring PARAMS((char *, char *)); # 257|-> static int unquoted_member PARAMS((int, char *)); # 258| # 259| #if defined (ARRAY_VARS) Error: COMPILER_WARNING (CWE-1164): bash-5.2/subst.c:277:23: warning[-Wunused-function]: ‘mb_getcharlens’ declared ‘static’ but never defined # 277 | static unsigned char *mb_getcharlens PARAMS((char *, int)); # | ^~~~~~~~~~~~~~ # 275| static char *pos_params PARAMS((char *, int, int, int, int)); # 276| # 277|-> static unsigned char *mb_getcharlens PARAMS((char *, int)); # 278| # 279| static char *remove_upattern PARAMS((char *, char *, int)); Error: COMPILER_WARNING (CWE-1164): bash-5.2/subst.c:292:14: warning[-Wunused-function]: ‘variable_remove_pattern’ declared ‘static’ but never defined # 292 | static char *variable_remove_pattern PARAMS((char *, char *, int, int)); # | ^~~~~~~~~~~~~~~~~~~~~~~ # 290| static int getpatspec PARAMS((int, char *)); # 291| static char *getpattern PARAMS((char *, int, int)); # 292|-> static char *variable_remove_pattern PARAMS((char *, char *, int, int)); # 293| static char *list_remove_pattern PARAMS((WORD_LIST *, char *, int, int, int)); # 294| static char *parameter_list_remove_pattern PARAMS((int, char *, int, int)); Error: COMPILER_WARNING (CWE-1164): bash-5.2/subst.c:349:14: warning[-Wunused-function]: ‘pos_params_casemod’ declared ‘static’ but never defined # 349 | static char *pos_params_casemod PARAMS((char *, char *, int, int)); # | ^~~~~~~~~~~~~~~~~~ # 347| static char *parameter_brace_patsub PARAMS((char *, char *, array_eltstate_t *, char *, int, int, int)); # 348| # 349|-> static char *pos_params_casemod PARAMS((char *, char *, int, int)); # 350| static char *parameter_brace_casemod PARAMS((char *, char *, array_eltstate_t *, int, char *, int, int, int)); # 351| Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘string_extract’ bash-5.2/subst.c:810:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 810 | while (c = string[i]) # | ^ # 808| i = *sindex; # 809| found = 0; # 810|-> while (c = string[i]) # 811| { # 812| if (c == '\\') Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘string_extract_double_quoted’ bash-5.2/subst.c:884:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 884 | while (c = string[i]) # | ^ # 882| j = 0; # 883| i = *sindex; # 884|-> while (c = string[i]) # 885| { # 886| /* Process a character that was quoted by a backslash. */ Error: COMPILER_WARNING (CWE-563): bash-5.2/subst.c:1030:9: warning[-Wunused-but-set-variable]: variable ‘ret’ set but not used # 1030 | char *ret; # | ^~~ # 1028| { # 1029| int c, i; # 1030|-> char *ret; # 1031| int pass_next, backquote, si; # 1032| DECLARE_MBSTATE; Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘skip_double_quoted’ bash-5.2/subst.c:1036:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 1036 | while (c = string[i]) # | ^ # 1034| pass_next = backquote = 0; # 1035| i = sind; # 1036|-> while (c = string[i]) # 1037| { # 1038| if (pass_next) Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘string_extract_verbatim’ bash-5.2/subst.c:1204:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 1204 | while (c = string[i]) # | ^ # 1202| wcharlist = 0; # 1203| #endif # 1204|-> while (c = string[i]) # 1205| { # 1206| #if defined (HANDLE_MULTIBYTE) Error: COMPILER_WARNING (CWE-563): bash-5.2/subst.c: scope_hint: In function ‘extract_delimited_string’ bash-5.2/subst.c:1367:9: warning[-Wunused-but-set-variable]: variable ‘t’ set but not used # 1367 | char *t, *result; # | ^ # 1365| int i, c, si; # 1366| size_t slen; # 1367|-> char *t, *result; # 1368| int pass_character, nesting_level, in_comment; # 1369| int len_closer, len_opener, len_alt_opener; Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘extract_heredoc_dolbrace_string’ bash-5.2/subst.c:1554:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 1554 | while (c = string[i]) # | ^ # 1552| # 1553| i = *sindex; # 1554|-> while (c = string[i]) # 1555| { # 1556| if (pass_character) Error: COMPILER_WARNING: bash-5.2/subst.c: scope_hint: In function ‘extract_dollar_brace_string’ bash-5.2/subst.c:1638:11: warning[-Wstringop-truncation]: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length # 1638 | strncpy (result + result_index, t, tlen); # | ^ bash-5.2/subst.c:1634:18: note: length computed here # 1634 | tlen = strlen (t); # | ^~~~~~~~~~ # 1636| # 1637| RESIZE_MALLOCED_BUFFER (result, result_index, tlen + 1, result_size, 64); # 1638|-> strncpy (result + result_index, t, tlen); # 1639| result_index += tlen; # 1640| free (t); Error: COMPILER_WARNING (CWE-563): bash-5.2/subst.c:1820:18: warning[-Wunused-but-set-variable]: variable ‘t’ set but not used # 1820 | char *result, *t; # | ^ # 1818| size_t slen; # 1819| int pass_character, nesting_level, si, dolbrace_state; # 1820|-> char *result, *t; # 1821| DECLARE_MBSTATE; # 1822| Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘extract_dollar_brace_string’ bash-5.2/subst.c:1841:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 1841 | while (c = string[i]) # | ^ # 1839| # 1840| i = *sindex; # 1841|-> while (c = string[i]) # 1842| { # 1843| if (pass_character) Error: COMPILER_WARNING (CWE-563): bash-5.2/subst.c:2069:9: warning[-Wunused-but-set-variable]: variable ‘temp’ set but not used # 2069 | char *temp, *ss; # | ^~~~ # 2067| int i, pass_next, backq, si, c, count, oldjmp; # 2068| size_t slen; # 2069|-> char *temp, *ss; # 2070| DECLARE_MBSTATE; # 2071| Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘skip_matched_pair’ bash-5.2/subst.c:2083:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 2083 | while (c = string[i]) # | ^ # 2081| pass_next = backq = 0; # 2082| ss = (char *)string; # 2083|-> while (c = string[i]) # 2084| { # 2085| if (pass_next) Error: COMPILER_WARNING (CWE-563): bash-5.2/subst.c:2191:9: warning[-Wunused-but-set-variable]: variable ‘temp’ set but not used # 2191 | char *temp, open[3]; # | ^~~~ # 2189| int arithexp, skipcol; # 2190| size_t slen; # 2191|-> char *temp, open[3]; # 2192| DECLARE_MBSTATE; # 2193| Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘skip_to_delim’ bash-5.2/subst.c:2208:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 2208 | while (c = string[i]) # | ^ # 2206| i = start; # 2207| pass_next = backq = dquote = 0; # 2208|-> while (c = string[i]) # 2209| { # 2210| /* If this is non-zero, we should not let quote characters be delimiters Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘skip_to_histexp’ bash-5.2/subst.c:2383:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 2383 | while (c = string[i]) # | ^ # 2381| i = start; # 2382| pass_next = backq = dquote = 0; # 2383|-> while (c = string[i]) # 2384| { # 2385| if (pass_next) Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘do_assignment_internal’ bash-5.2/subst.c:3613:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 3613 | if (t = mbschr (name, LBRACK)) # | ^ # 3611| # 3612| #if defined (ARRAY_VARS) # 3613|-> if (t = mbschr (name, LBRACK)) # 3614| { # 3615| if (assign_list) Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘expand_string_dollar_quote’ bash-5.2/subst.c:4192:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 4192 | while (c = string[sindex]) # | ^ # 4190| retind = 0; # 4191| # 4192|-> while (c = string[sindex]) # 4193| { # 4194| switch (c) Error: CPPCHECK_WARNING (CWE-562): bash-5.2/subst.c:4778: error[returnDanglingLifetime]: Returning pointer to local variable 'result' that will be invalid when returning. # 4776| # 4777| if (strchr (string, CTLESC) == 0) # 4778|-> return (strcpy (result, string)); # 4779| # 4780| quote_spaces = (ifs_value && *ifs_value == 0); Error: CPPCHECK_WARNING (CWE-562): bash-5.2/subst.c:4910: error[returnDanglingLifetime]: Returning pointer to local variable 'result' that will be invalid when returning. # 4908| each character. Just return a copy of the string passed to us. */ # 4909| if (strchr (string, CTLESC) == NULL) # 4910|-> return (strcpy (result, string)); # 4911| # 4912| send = string + slen; Error: COMPILER_WARNING (CWE-457): bash-5.2/subst.c: scope_hint: In function ‘read_comsub’ bash-5.2/subst.c:6823:11: warning[-Wmaybe-uninitialized]: ‘bufp’ may be used uninitialized # 6823 | c = *bufp++; # | ^~~~~~~ bash-5.2/subst.c:6788:40: note: ‘bufp’ was declared here # 6788 | char *istring, buf[COMSUB_PIPEBUF], *bufp; # | ^~~~ # 6821| bufp = buf; # 6822| } # 6823|-> c = *bufp++; # 6824| # 6825| if (c == 0) Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘parameter_brace_expand_word’ bash-5.2/subst.c:7514:12: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 7514 | else if (var = find_variable (name)) # | ^~~ # 7512| } # 7513| #endif # 7514|-> else if (var = find_variable (name)) # 7515| { # 7516| if (var_isset (var) && invisible_p (var) == 0) Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c:7547:12: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 7547 | else if (var = find_variable_last_nameref (name, 0)) # | ^~~ # 7545| temp = (char *)NULL; # 7546| } # 7547|-> else if (var = find_variable_last_nameref (name, 0)) # 7548| { # 7549| temp = nameref_cell (var); Error: COMPILER_WARNING (CWE-457): bash-5.2/subst.c: scope_hint: In function ‘parameter_brace_find_indir’ bash-5.2/subst.c:7608:33: warning[-Wmaybe-uninitialized]: ‘oldex’ may be used uninitialized # 7608 | expand_no_split_dollar_star = oldex; # | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ bash-5.2/subst.c:7589:15: note: ‘oldex’ was declared here # 7589 | int pflags, oldex; # | ^~~~~ # 7606| w = parameter_brace_expand_word (name, var_is_special, quoted, pflags, 0); # 7607| if (var_is_special) # 7608|-> expand_no_split_dollar_star = oldex; # 7609| # 7610| t = w->word; Error: COMPILER_WARNING (CWE-457): bash-5.2/subst.c:7657:31: warning[-Wmaybe-uninitialized]: ‘v’ may be used uninitialized # 7657 | if (legal_identifier (name) && v == 0) # | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~ bash-5.2/subst.c: scope_hint: In function ‘param_expand’ bash-5.2/subst.c:7635:14: note: ‘v’ was declared here # 7635 | SHELL_VAR *v; # | ^ # 7655| ok (currently). Only references to unset variables are errors at this # 7656| point. */ # 7657|-> if (legal_identifier (name) && v == 0) # 7658| { # 7659| report_error (_("%s: invalid indirect expansion"), name); Error: COMPILER_WARNING (CWE-457): bash-5.2/subst.c:8185:48: warning[-Wmaybe-uninitialized]: ‘a’ may be used uninitialized # 8185 | len = assoc_p (v) ? assoc_num_elements (h) : array_num_elements (a); bash-5.2/subst.c: scope_hint: In function ‘parameter_brace_substring’ bash-5.2/subst.c:8123:9: note: ‘a’ was declared here # 8123 | ARRAY *a; # | ^ # 8183| /* For arrays, the second offset deals with the number of elements. */ # 8184| if (vtype == VT_ARRAYVAR) # 8185|-> len = assoc_p (v) ? assoc_num_elements (h) : array_num_elements (a); # 8186| #endif # 8187| Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘shouldexp_replacement’ bash-5.2/subst.c:8903:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 8903 | while (c = s[sindex]) # | ^ # 8901| sindex = 0; # 8902| slen = STRLEN (s); # 8903|-> while (c = s[sindex]) # 8904| { # 8905| if (c == '\\') Error: COMPILER_WARNING (CWE-563): bash-5.2/subst.c: scope_hint: In function ‘pat_subst’ bash-5.2/subst.c:9036:18: warning[-Wunused-variable]: unused variable ‘clen’ # 9036 | size_t clen; # | ^~~~ # 9034| we increment one character to avoid infinite recursion. */ # 9035| char *p, *origp, *origs; # 9036|-> size_t clen; # 9037| # 9038| RESIZE_MALLOCED_BUFFER (ret, rptr, locale_mb_cur_max, rsize, 64); Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘parameter_brace_expand’ bash-5.2/subst.c:9628:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 9628 | if (c = string[sindex]) # | ^ # 9626| /* Find out what character ended the variable name. Then # 9627| do the appropriate thing. */ # 9628|-> if (c = string[sindex]) # 9629| sindex++; # 9630| Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c:9638:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 9638 | if (c = string[sindex]) # | ^ # 9636| { # 9637| check_nullness++; # 9638|-> if (c = string[sindex]) # 9639| sindex++; # 9640| } Error: COMPILER_WARNING (CWE-563): bash-5.2/subst.c:10981:7: warning[-Wunused-but-set-variable]: variable ‘local_expanded’ set but not used #10981 | int local_expanded; # | ^~~~~~~~~~~~~~ #10979| int internal_tilde; #10980| int split_on_spaces; #10981|-> int local_expanded; #10982| int tflag; #10983| int pflags; /* flags passed to param_expand */ Error: COMPILER_WARNING (CWE-1164): bash-5.2/subst.c: scope_hint: In function ‘expand_word_internal’ bash-5.2/subst.c:11655:1: warning[-Wunused-label]: label ‘add_quoted_character’ defined but not used #11655 | add_quoted_character: # | ^~~~~~~~~~~~~~~~~~~~ #11653| if ((quoted&(Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) == 0) #11654| has_quoted_ifs++; #11655|-> add_quoted_character: #11656| if (string[sindex]) /* from old goto dollar_add_string */ #11657| sindex++; Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘string_quote_removal’ bash-5.2/subst.c:11913:29: warning[-Wparentheses]: suggest parentheses around assignment used as truth value #11913 | for (dquote = sindex = 0; c = string[sindex];) # | ^ #11911| r = result_string = (char *)xmalloc (slen + 1); #11912| #11913|-> for (dquote = sindex = 0; c = string[sindex];) #11914| { #11915| switch (c) Error: COMPILER_WARNING (CWE-563): bash-5.2/subst.c: scope_hint: In function ‘glob_expand_word_list’ bash-5.2/subst.c:12317:7: warning[-Wunused-variable]: unused variable ‘x’ #12317 | int x; # | ^ #12315| WORD_LIST *glob_list, *output_list, *disposables, *next; #12316| WORD_DESC *tword; #12317|-> int x; #12318| #12319| output_list = disposables = (WORD_LIST *)NULL; Error: COMPILER_WARNING (CWE-569): bash-5.2/subst.c: scope_hint: In function ‘brace_expand_word_list’ bash-5.2/subst.c:12457:28: warning[-Wparentheses]: suggest parentheses around assignment used as truth value #12457 | for (eindex = 0; temp_string = expansions[eindex]; eindex++) # | ^~~~~~~~~~~ #12455| expansions = brace_expand (tlist->word->word); #12456| #12457|-> for (eindex = 0; temp_string = expansions[eindex]; eindex++) #12458| { #12459| w = alloc_word_desc (); Error: COMPILER_WARNING (CWE-563): bash-5.2/subst.c:12662:28: warning[-Wunused-but-set-variable]: variable ‘inheriting’ set but not used #12662 | int t, opti, oind, skip, inheriting; # | ^~~~~~~~~~ #12660| { #12661| char opts[16], omap[128]; #12662|-> int t, opti, oind, skip, inheriting; #12663| WORD_LIST *l; #12664| Error: COMPILER_WARNING (CWE-823): bash-5.2/subst.c: scope_hint: In function ‘expand_declaration_argument’ bash-5.2/subst.c:12718:33: warning[-Wchar-subscripts]: array subscript has type ‘char’ #12718 | omap[l->word->word[oind]] = 1; # | ~~~~~~~~~~~~~^~~~~~ #12716| case 'u': #12717| case 'c': #12718|-> omap[l->word->word[oind]] = 1; #12719| if (opti == 0) #12720| opts[opti++] = optchar; Error: COMPILER_WARNING (CWE-563): bash-5.2/subst.c: scope_hint: In function ‘expand_word_list_internal’ bash-5.2/subst.c:12974:25: warning[-Wunused-variable]: unused variable ‘temp_list’ #12974 | WORD_LIST *new_list, *temp_list; # | ^~~~~~~~~ #12972| int eflags; #12973| { #12974|-> WORD_LIST *new_list, *temp_list; #12975| #12976| tempenv_assign_error = 0; Error: CPPCHECK_WARNING: bash-5.2/support/bashversion.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-569): bash-5.2/support/bashversion.c: scope_hint: In function ‘main’ bash-5.2/support/bashversion.c:70:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 70 | if (progname = strrchr (argv[0], '/')) # | ^~~~~~~~ # 68| char dv[128], *rv; # 69| # 70|-> if (progname = strrchr (argv[0], '/')) # 71| progname++; # 72| else Error: CLANG_WARNING: bash-5.2/support/bashversion.c:111:3: warning[deadcode.DeadStores]: Value stored to 'argv' is never read # 109| # 110| argc -= optind; # 111|-> argv += optind; # 112| # 113| if (argc > 0) Error: CPPCHECK_WARNING: bash-5.2/support/man2html.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c:104:13: warning[-Wunused-variable]: ‘location_base’ defined but not used # 104 | static char location_base[NULL_TERMINATED(MED_STR_MAX)] = ""; # | ^~~~~~~~~~~~~ # 102| #endif # 103| # 104|-> static char location_base[NULL_TERMINATED(MED_STR_MAX)] = ""; # 105| # 106| static char th_page_and_sec[128] = { '\0' }; Error: COMPILER_WARNING (CWE-1164): bash-5.2/support/man2html.c:148:1: warning[-Wunused-function]: ‘strgrow’ defined but not used # 148 | strgrow(char *old, int len) # | ^~~~~~~ # 146| # 147| static char * # 148|-> strgrow(char *old, int len) # 149| { # 150| char *new = realloc(old, (strlen(old) + len + 1) * sizeof(char)); Error: COMPILER_WARNING (CWE-1164): bash-5.2/support/man2html.c:190:1: warning[-Wunused-function]: ‘strduplicate’ defined but not used # 190 | strduplicate(char *from) # | ^~~~~~~~~~~~ # 188| */ # 189| static char * # 190|-> strduplicate(char *from) # 191| { # 192| char *new = stralloc(strlen(from)); Error: COMPILER_WARNING (CWE-1164): bash-5.2/support/man2html.c:210:1: warning[-Wunused-function]: ‘strmaxcat’ defined but not used # 210 | strmaxcat(char *to, char *from, int n) # | ^~~~~~~~~ # 208| # 209| static char * # 210|-> strmaxcat(char *to, char *from, int n) # 211| { # 212| int to_len = strlen(to); Error: COMPILER_WARNING (CWE-1164): bash-5.2/support/man2html.c:240:1: warning[-Wunused-function]: ‘escape_input’ defined but not used # 240 | escape_input(char *str) # | ^~~~~~~~~~~~ # 238| */ # 239| static char * # 240|-> escape_input(char *str) # 241| { # 242| int i, j = 0; Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c:298:14: warning[-Wunused-variable]: ‘fname’ defined but not used # 298 | static char *fname; # | ^~~~~ # 296| #define INDEXFILE "/tmp/manindex.list" # 297| # 298|-> static char *fname; # 299| static FILE *idxfile; # 300| Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c:299:14: warning[-Wunused-variable]: ‘idxfile’ defined but not used # 299 | static FILE *idxfile; # | ^~~~~~~ # 297| # 298| static char *fname; # 299|-> static FILE *idxfile; # 300| # 301| static STRDEF *chardef, *strdef, *defdef; Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c:428:13: warning[-Wunused-variable]: ‘eqndelimopen’ defined but not used # 428 | static char eqndelimopen = 0, eqndelimclose = 0; # | ^~~~~~~~~~~~ # 426| # 427| # 428|-> static char eqndelimopen = 0, eqndelimclose = 0; # 429| static char escapesym = '\\', nobreaksym = '\'', controlsym = '.', fieldsym = 0, padsym = 0; # 430| Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c:428:31: warning[-Wunused-variable]: ‘eqndelimclose’ defined but not used # 428 | static char eqndelimopen = 0, eqndelimclose = 0; # | ^~~~~~~~~~~~~ # 426| # 427| # 428|-> static char eqndelimopen = 0, eqndelimclose = 0; # 429| static char escapesym = '\\', nobreaksym = '\'', controlsym = '.', fieldsym = 0, padsym = 0; # 430| Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c: scope_hint: In function ‘read_man_page’ bash-5.2/support/man2html.c:508:17: warning[-Wunused-variable]: unused variable ‘i’ # 508 | int i; # | ^ # 506| { # 507| char *man_buf = NULL; # 508|-> int i; # 509| FILE *man_stream = NULL; # 510| struct stat stbuf; Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c:937:12: warning[-Wunused-variable]: ‘asint’ defined but not used # 937 | static int asint = 0; # | ^~~~~ # 935| } # 936| # 937|-> static int asint = 0; # 938| static int intresult = 0; # 939| Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c:1439:17: warning[-Wunused-variable]: unused variable ‘t’ # 1439 | char *t, *h, *g; # | ^ # 1437| scan_table(char *c) # 1438| { # 1439|-> char *t, *h, *g; # 1440| int center = 0, expand = 0, box = 0, border = 0, linesize = 1; # 1441| int i, j, maxcol = 0, finished = 0; Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c: scope_hint: In function ‘scan_table’ bash-5.2/support/man2html.c:1444:44: warning[-Wunused-variable]: unused variable ‘ftable’ # 1444 | TABLEROW *layout = NULL, *currow, *ftable; # | ^~~~~~ # 1442| int oldfont, oldsize, oldfillout; # 1443| char itemsep = '\t'; # 1444|-> TABLEROW *layout = NULL, *currow, *ftable; # 1445| TABLEITEM *curfield; # 1446| Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c: scope_hint: In function ‘scan_expression’ bash-5.2/support/man2html.c:1774:36: warning[-Wunused-variable]: unused variable ‘j’ # 1774 | int value = 0, value2, j = 0, sign = 1, opex = 0; # | ^ # 1772| scan_expression(char *c, int *result) # 1773| { # 1774|-> int value = 0, value2, j = 0, sign = 1, opex = 0; # 1775| char oper = 'c'; # 1776| Error: COMPILER_WARNING (CWE-569): bash-5.2/support/man2html.c: scope_hint: In function ‘skip_till_newline’ bash-5.2/support/man2html.c:2151:19: warning[-Wparentheses]: suggest parentheses around ‘&&’ within ‘||’ # 2151 | while (*c && *c != '\n' || lvl > 0) { # | ~~~^~~~~~~~~~~~~ # 2149| int lvl = 0; # 2150| # 2151|-> while (*c && *c != '\n' || lvl > 0) { # 2152| if (*c == '\\') { # 2153| c++; Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c: scope_hint: In function ‘scan_request’ bash-5.2/support/man2html.c:2243:41: warning[-Wunused-variable]: unused variable ‘oldcurpos’ # 2243 | int oldcurpos = curpos; # | ^~~~~~~~~ # 2241| { # 2242| STRDEF *de; # 2243|-> int oldcurpos = curpos; # 2244| # 2245| c = c + j; Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c:2540:41: warning[-Wunused-variable]: unused variable ‘f’ # 2540 | FILE *f; # | ^ # 2538| case V('s', 'o'): # 2539| { # 2540|-> FILE *f; # 2541| struct stat stbuf; # 2542| int l = 0; Error: CPPCHECK_WARNING (CWE-786): bash-5.2/support/man2html.c:2699: error[negativeIndex]: Array 'wordlist[100]' accessed at index wordlist[*][-1], which is out of bounds. # 2697| curpos++; # 2698| } # 2699|-> wordlist[i][-1] = ' '; # 2700| out_html(change_to_font(font[i & 1])); # 2701| scan_troff(wordlist[i], 1, NULL); Error: CPPCHECK_WARNING (CWE-786): bash-5.2/support/man2html.c:2899: error[negativeIndex]: Array 'wordlist[100]' accessed at index wordlist[*][-1], which is out of bounds. # 2897| char *t; # 2898| for (i = 1; i < words; i++) # 2899|-> wordlist[i][-1] = '\0'; # 2900| *sl = '\0'; # 2901| output_possible = 1; Error: CPPCHECK_WARNING (CWE-786): bash-5.2/support/man2html.c:2938: error[negativeIndex]: Array 'wordlist[100]' accessed at index wordlist[*][-1], which is out of bounds. # 2936| out_html(change_to_font('I')); # 2937| if (words > 1) # 2938|-> wordlist[1][-1] = '\0'; # 2939| c = lookup_abbrev(wordlist[0]); # 2940| curpos += strlen(c); Error: CPPCHECK_WARNING (CWE-457): bash-5.2/support/man2html.c:3099: warning[uninitvar]: Uninitialized variable: list_options # 3097| strlimitcpy(list_options, c, nl - c, MED_STR_MAX); # 3098| } # 3099|-> if (strstr(list_options, "-bullet")) { /* HTML Unnumbered List */ # 3100| dl_set[itemdepth] = BL_BULLET_LIST; # 3101| out_html("<UL>\n"); Error: CPPCHECK_WARNING (CWE-457): bash-5.2/support/man2html.c:3232: warning[uninitvar]: Uninitialized variable: bd_options # 3230| mandoc_bd_options = 0; /* Remember options for # 3231| * terminating Bl */ # 3232|-> if (strstr(bd_options, "-offset indent")) { # 3233| mandoc_bd_options |= BD_INDENT; # 3234| out_html("<BLOCKQUOTE>\n"); Error: CPPCHECK_WARNING (CWE-786): bash-5.2/support/man2html.c:3679: error[negativeIndex]: Array 'wordlist[100]' accessed at index wordlist[*][-1], which is out of bounds. # 3677| *sl = '\0'; # 3678| for (i = 1; i < words; i++) # 3679|-> wordlist[i][-1] = '\0'; # 3680| for (i = 0; i < words; i++) { # 3681| char *h = NULL; Error: COMPILER_WARNING (CWE-569): bash-5.2/support/man2html.c:3693:45: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 3693 | for (i = 0; owndef->st[deflen + 2 + i] = owndef->st[i]; i++); # | ^~~~~~ # 3691| wordlist[i] = NULL; # 3692| deflen = strlen(owndef->st); # 3693|-> for (i = 0; owndef->st[deflen + 2 + i] = owndef->st[i]; i++); # 3694| oldargument = argument; # 3695| argument = wordlist; Error: COMPILER_WARNING (CWE-1164): bash-5.2/support/man2html.c: scope_hint: At top level bash-5.2/support/man2html.c:3748:1: warning[-Wunused-function]: ‘flush’ defined but not used # 3748 | flush(void) # | ^~~~~ # 3746| # 3747| static void # 3748|-> flush(void) # 3749| { # 3750| } Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c:3763:17: warning[-Wunused-variable]: unused variable ‘i’ # 3763 | int i; # | ^ # 3761| char intbuff[NULL_TERMINATED(MED_STR_MAX)]; # 3762| int ibp = 0; # 3763|-> int i; # 3764| char *exbuffer; # 3765| int exbuffpos, exbuffmax, exscaninbuff, exnewline_for_fun; Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c: scope_hint: In function ‘scan_troff’ bash-5.2/support/man2html.c:3822:33: warning[-Wunused-variable]: unused variable ‘mx’ # 3822 | int mx; # | ^~ # 3820| h--; # 3821| } else { # 3822|-> int mx; # 3823| # 3824| if (h[-1] == '\n' && still_dd && isalnum(*h)) { Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c:3992:17: warning[-Wunused-variable]: unused variable ‘f’ # 3992 | FILE *f; # | ^ # 3990| main(int argc, char **argv) # 3991| { # 3992|-> FILE *f; # 3993| char *t; # 3994| int l, i; Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c:3994:17: warning[-Wunused-variable]: unused variable ‘l’ # 3994 | int l, i; # | ^ # 3992| FILE *f; # 3993| char *t; # 3994|-> int l, i; # 3995| char *buf; # 3996| char *h, *fullname; Error: COMPILER_WARNING (CWE-563): bash-5.2/support/man2html.c: scope_hint: In function ‘main’ bash-5.2/support/man2html.c:3996:21: warning[-Wunused-variable]: unused variable ‘fullname’ # 3996 | char *h, *fullname; # | ^~~~~~~~ # 3994| int l, i; # 3995| char *buf; # 3996|-> char *h, *fullname; # 3997| STRDEF *stdf; # 3998| Error: CPPCHECK_WARNING: bash-5.2/test.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: bash-5.2/trap.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING (CWE-457): bash-5.2/trap.c:443: error[legacyUninitvar]: Uninitialized variable: save_return_catch # 441| if (return_catch_flag) # 442| { # 443|-> COPY_PROCENV (return_catch, save_return_catch); # 444| function_code = setjmp_nosigs (return_catch); # 445| } Error: COMPILER_WARNING: bash-5.2/trap.c: scope_hint: In function ‘restore_default_signal’ bash-5.2/trap.c:918:15: warning[-Warray-bounds=]: array subscript 68 is above array bounds of ‘int[68]’ # 918 | if (sigmodes[sig] & SIG_HARD_IGNORE) # | ~~~~~~~~^~~~~ bash-5.2/trap.c:75:12: note: while referencing ‘sigmodes’ # 75 | static int sigmodes[BASH_NSIG]; # | ^~~~~~~~ # 916| /* A signal ignored on entry to the shell cannot be trapped or reset, but # 917| no error is reported when attempting to do so. Thanks Posix.2. */ # 918|-> if (sigmodes[sig] & SIG_HARD_IGNORE) # 919| return; # 920| Error: CLANG_WARNING: bash-5.2/trap.c:1065:3: warning[deadcode.DeadStores]: Value stored to 'old_modes' is never read # 1063| #endif # 1064| # 1065|-> old_modes = old_running = -1; # 1066| # 1067| trap_exit_value = function_code = 0; Error: CLANG_WARNING: bash-5.2/trap.c:1065:15: warning[deadcode.DeadStores]: Although the value stored to 'old_running' is used in the enclosing expression, the value is never actually read from 'old_running' # 1063| #endif # 1064| # 1065|-> old_modes = old_running = -1; # 1066| # 1067| trap_exit_value = function_code = 0; Error: CPPCHECK_WARNING (CWE-457): bash-5.2/trap.c:1113: error[uninitvar]: Uninitialized variable: save_return_catch # 1111| if (return_catch_flag) # 1112| { # 1113|-> COPY_PROCENV (return_catch, save_return_catch); # 1114| function_code = setjmp_nosigs (return_catch); # 1115| } Error: CPPCHECK_WARNING: bash-5.2/unwind_prot.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-569): bash-5.2/unwind_prot.c: scope_hint: In function ‘unwind_frame_discard_internal’ bash-5.2/unwind_prot.c:272:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 272 | while (elt = unwind_protect_list) # | ^~~ # 270| # 271| found = 0; # 272|-> while (elt = unwind_protect_list) # 273| { # 274| unwind_protect_list = unwind_protect_list->head.next; Error: COMPILER_WARNING (CWE-569): bash-5.2/unwind_prot.c: scope_hint: In function ‘unwind_frame_run_internal’ bash-5.2/unwind_prot.c:307:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 307 | while (elt = unwind_protect_list) # | ^~~ # 305| # 306| found = 0; # 307|-> while (elt = unwind_protect_list) # 308| { # 309| unwind_protect_list = elt->head.next; Error: CPPCHECK_WARNING: bash-5.2/variables.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-563): bash-5.2/variables.c:188:21: warning[-Wunused-variable]: ‘last_context_searched’ defined but not used # 188 | static VAR_CONTEXT *last_context_searched; # | ^~~~~~~~~~~~~~~~~~~~~ # 186| # 187| static HASH_TABLE *last_table_searched; /* hash_lookup sets this */ # 188|-> static VAR_CONTEXT *last_context_searched; # 189| # 190| /* Some forward declarations. */ Error: COMPILER_WARNING (CWE-569): bash-5.2/variables.c: scope_hint: In function ‘initialize_shell_variables’ bash-5.2/variables.c:425:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 425 | if (temp_var = find_function (tname)) # | ^~~~~~~~ # 423| free (temp_string); /* parse_and_execute does this */ # 424| # 425|-> if (temp_var = find_function (tname)) # 426| { # 427| VSETATTR (temp_var, (att_exported|att_imported)); Error: COMPILER_WARNING (CWE-569): bash-5.2/variables.c:432:19: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 432 | if (temp_var = bind_invalid_envvar (name, string, 0)) # | ^~~~~~~~ # 430| else # 431| { # 432|-> if (temp_var = bind_invalid_envvar (name, string, 0)) # 433| { # 434| VSETATTR (temp_var, (att_exported | att_imported | att_invisible)); Error: CLANG_WARNING: bash-5.2/variables.c:545:3: warning[deadcode.DeadStores]: Value stored to 'temp_var' is never read # 543| # 544| /* Set up initial value of $_ */ # 545|-> temp_var = set_if_not ("_", dollar_vars[0]); # 546| # 547| /* Remember this pid. */ Error: CLANG_WARNING: bash-5.2/variables.c:552:3: warning[deadcode.DeadStores]: Value stored to 'temp_var' is never read # 550| /* Now make our own defaults in case the vars that we think are # 551| important are missing. */ # 552|-> temp_var = set_if_not ("PATH", DEFAULT_PATH_VALUE); # 553| temp_var = set_if_not ("TERM", "dumb"); # 554| Error: CLANG_WARNING: bash-5.2/variables.c:553:3: warning[deadcode.DeadStores]: Value stored to 'temp_var' is never read # 551| important are missing. */ # 552| temp_var = set_if_not ("PATH", DEFAULT_PATH_VALUE); # 553|-> temp_var = set_if_not ("TERM", "dumb"); # 554| # 555| #if defined (__QNX__) Error: CLANG_WARNING: bash-5.2/variables.c:625:3: warning[deadcode.DeadStores]: Value stored to 'temp_var' is never read # 623| to it. */ # 624| name = get_bash_name (); # 625|-> temp_var = bind_variable ("BASH", name, 0); # 626| free (name); # 627| Error: CLANG_WARNING: bash-5.2/variables.c:699:3: warning[deadcode.DeadStores]: Value stored to 'temp_var' is never read # 697| uidset (); # 698| # 699|-> temp_var = set_if_not ("BASH_LOADABLES_PATH", DEFAULT_LOADABLE_BUILTINS_PATH); # 700| # 701| temp_var = find_variable ("BASH_XTRACEFD"); Error: COMPILER_WARNING (CWE-563): bash-5.2/variables.c: scope_hint: In function ‘set_machine_vars’ bash-5.2/variables.c:723:14: warning[-Wunused-but-set-variable]: variable ‘temp_var’ set but not used # 723 | SHELL_VAR *temp_var; # | ^~~~~~~~ # 721| set_machine_vars () # 722| { # 723|-> SHELL_VAR *temp_var; # 724| # 725| temp_var = set_if_not ("HOSTTYPE", HOSTTYPE); Error: CLANG_WARNING: bash-5.2/variables.c:725:3: warning[deadcode.DeadStores]: Value stored to 'temp_var' is never read # 723| SHELL_VAR *temp_var; # 724| # 725|-> temp_var = set_if_not ("HOSTTYPE", HOSTTYPE); # 726| temp_var = set_if_not ("OSTYPE", OSTYPE); # 727| temp_var = set_if_not ("MACHTYPE", MACHTYPE); Error: CLANG_WARNING: bash-5.2/variables.c:726:3: warning[deadcode.DeadStores]: Value stored to 'temp_var' is never read # 724| # 725| temp_var = set_if_not ("HOSTTYPE", HOSTTYPE); # 726|-> temp_var = set_if_not ("OSTYPE", OSTYPE); # 727| temp_var = set_if_not ("MACHTYPE", MACHTYPE); # 728| Error: CLANG_WARNING: bash-5.2/variables.c:727:3: warning[deadcode.DeadStores]: Value stored to 'temp_var' is never read # 725| temp_var = set_if_not ("HOSTTYPE", HOSTTYPE); # 726| temp_var = set_if_not ("OSTYPE", OSTYPE); # 727|-> temp_var = set_if_not ("MACHTYPE", MACHTYPE); # 728| # 729| temp_var = set_if_not ("HOSTNAME", current_host_name); Error: CLANG_WARNING: bash-5.2/variables.c:729:3: warning[deadcode.DeadStores]: Value stored to 'temp_var' is never read # 727| temp_var = set_if_not ("MACHTYPE", MACHTYPE); # 728| # 729|-> temp_var = set_if_not ("HOSTNAME", current_host_name); # 730| } # 731| Error: CLANG_WARNING: bash-5.2/variables.c:752:5: warning[deadcode.DeadStores]: Value stored to 'temp_var' is never read # 750| temp_var = find_variable ("HOME"); # 751| if (temp_var == 0) # 752|-> temp_var = bind_variable ("HOME", sh_get_home_dir (), 0); # 753| #if 0 # 754| VSETATTR (temp_var, att_exported); Error: CLANG_WARNING: bash-5.2/variables.c:770:7: warning[deadcode.DeadStores]: Value stored to 'temp_var' is never read # 768| if (current_user.shell == 0) # 769| get_current_user_info (); # 770|-> temp_var = bind_variable ("SHELL", current_user.shell, 0); # 771| } # 772| #if 0 Error: CLANG_WARNING: bash-5.2/variables.c:1907:3: warning[deadcode.DeadStores]: Value stored to 'v' is never read # 1905| SHELL_VAR *v; # 1906| # 1907|-> v = init_seconds_var (); # 1908| # 1909| INIT_DYNAMIC_VAR ("BASH_ARGV0", (char *)NULL, get_bash_argv0, assign_bash_argv0); Error: CLANG_WARNING: bash-5.2/variables.c:1939:3: warning[deadcode.DeadStores]: Value stored to 'v' is never read # 1937| # 1938| #if defined (PUSHD_AND_POPD) && defined (ARRAY_VARS) # 1939|-> v = init_dynamic_array_var ("DIRSTACK", get_dirstack, assign_dirstack, 0); # 1940| #endif /* PUSHD_AND_POPD && ARRAY_VARS */ # 1941| Error: CLANG_WARNING: bash-5.2/variables.c:1943:3: warning[deadcode.DeadStores]: Value stored to 'v' is never read # 1941| # 1942| #if defined (ARRAY_VARS) # 1943|-> v = init_dynamic_array_var ("GROUPS", get_groupset, null_array_assign, att_noassign); # 1944| # 1945| # if defined (DEBUGGER) Error: CLANG_WARNING: bash-5.2/variables.c:1946:3: warning[deadcode.DeadStores]: Value stored to 'v' is never read # 1944| # 1945| # if defined (DEBUGGER) # 1946|-> v = init_dynamic_array_var ("BASH_ARGC", get_bashargcv, null_array_assign, att_noassign|att_nounset); # 1947| v = init_dynamic_array_var ("BASH_ARGV", get_bashargcv, null_array_assign, att_noassign|att_nounset); # 1948| # endif /* DEBUGGER */ Error: CLANG_WARNING: bash-5.2/variables.c:1947:3: warning[deadcode.DeadStores]: Value stored to 'v' is never read # 1945| # if defined (DEBUGGER) # 1946| v = init_dynamic_array_var ("BASH_ARGC", get_bashargcv, null_array_assign, att_noassign|att_nounset); # 1947|-> v = init_dynamic_array_var ("BASH_ARGV", get_bashargcv, null_array_assign, att_noassign|att_nounset); # 1948| # endif /* DEBUGGER */ # 1949| v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, att_noassign|att_nounset); Error: CLANG_WARNING: bash-5.2/variables.c:1949:3: warning[deadcode.DeadStores]: Value stored to 'v' is never read # 1947| v = init_dynamic_array_var ("BASH_ARGV", get_bashargcv, null_array_assign, att_noassign|att_nounset); # 1948| # endif /* DEBUGGER */ # 1949|-> v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, att_noassign|att_nounset); # 1950| v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, att_noassign|att_nounset); # 1951| Error: CLANG_WARNING: bash-5.2/variables.c:1950:3: warning[deadcode.DeadStores]: Value stored to 'v' is never read # 1948| # endif /* DEBUGGER */ # 1949| v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, att_noassign|att_nounset); # 1950|-> v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, att_noassign|att_nounset); # 1951| # 1952| v = init_dynamic_assoc_var ("BASH_CMDS", get_hashcmd, assign_hashcmd, att_nofree); Error: CLANG_WARNING: bash-5.2/variables.c:1952:3: warning[deadcode.DeadStores]: Value stored to 'v' is never read # 1950| v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, att_noassign|att_nounset); # 1951| # 1952|-> v = init_dynamic_assoc_var ("BASH_CMDS", get_hashcmd, assign_hashcmd, att_nofree); # 1953| # if defined (ALIAS) # 1954| v = init_dynamic_assoc_var ("BASH_ALIASES", get_aliasvar, assign_aliasvar, att_nofree); Error: CLANG_WARNING: bash-5.2/variables.c:1954:3: warning[deadcode.DeadStores]: Value stored to 'v' is never read # 1952| v = init_dynamic_assoc_var ("BASH_CMDS", get_hashcmd, assign_hashcmd, att_nofree); # 1953| # if defined (ALIAS) # 1954|-> v = init_dynamic_assoc_var ("BASH_ALIASES", get_aliasvar, assign_aliasvar, att_nofree); # 1955| # endif # 1956| #endif Error: CLANG_WARNING: bash-5.2/variables.c:1958:3: warning[deadcode.DeadStores]: Value stored to 'v' is never read # 1956| #endif # 1957| # 1958|-> v = init_funcname_var (); # 1959| } # 1960| Error: COMPILER_WARNING (CWE-569): bash-5.2/variables.c: scope_hint: In function ‘var_lookup’ bash-5.2/variables.c:2012:9: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 2012 | if (v = hash_lookup (name, vc->table)) # | ^ # 2010| v = (SHELL_VAR *)NULL; # 2011| for (vc = vcontext; vc; vc = vc->down) # 2012|-> if (v = hash_lookup (name, vc->table)) # 2013| break; # 2014| Error: COMPILER_WARNING (CWE-563): bash-5.2/variables.c: scope_hint: In function ‘nameref_transform_name’ bash-5.2/variables.c:2322:9: warning[-Wunused-variable]: unused variable ‘newname’ # 2322 | char *newname; # | ^~~~~~~ # 2320| { # 2321| SHELL_VAR *v; # 2322|-> char *newname; # 2323| # 2324| v = 0; Error: COMPILER_WARNING (CWE-1164): bash-5.2/variables.c: scope_hint: At top level bash-5.2/variables.c:2554:1: warning[-Wunused-function]: ‘var_sametype’ defined but not used # 2554 | var_sametype (v1, v2) # | ^~~~~~~~~~~~ # 2552| # 2553| static int # 2554|-> var_sametype (v1, v2) # 2555| SHELL_VAR *v1; # 2556| SHELL_VAR *v2; Error: CLANG_WARNING: bash-5.2/variables.c:2746:13: warning[core.NullDereference]: Access to field 'flags' results in a dereference of a null pointer (loaded from variable 'vc') # 2744| # 2745| set_local_var_flags: # 2746|-> vc->flags |= VC_HASLOCAL; # 2747| # 2748| new_var->context = variable_context; Error: CLANG_WARNING: bash-5.2/variables.c:2989:16: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'value') # 2987| strcpy (retval+olen, value); # 2988| } # 2989|-> else if (*value) # 2990| retval = savestring (value); # 2991| else Error: CLANG_WARNING: bash-5.2/variables.c:3570:7: warning[deadcode.DeadStores]: Value stored to 'entry' is never read # 3568| { # 3569| dispose_function_def_contents (entry); # 3570|-> entry = copy_function_def_contents (value, entry); # 3571| } # 3572| else if (entry) Error: COMPILER_WARNING (CWE-569): bash-5.2/variables.c: scope_hint: In function ‘delete_var’ bash-5.2/variables.c:3958:9: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 3958 | if (elt = hash_remove (name, v->table, 0)) # | ^~~ # 3956| # 3957| for (elt = (BUCKET_CONTENTS *)NULL, v = vc; v; v = v->down) # 3958|-> if (elt = hash_remove (name, v->table, 0)) # 3959| break; # 3960| Error: COMPILER_WARNING (CWE-569): bash-5.2/variables.c: scope_hint: In function ‘makunbound’ bash-5.2/variables.c:3987:9: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 3987 | if (elt = hash_remove (name, v->table, 0)) # | ^~~ # 3985| # 3986| for (elt = (BUCKET_CONTENTS *)NULL, v = vc; v; v = v->down) # 3987|-> if (elt = hash_remove (name, v->table, 0)) # 3988| break; # 3989| Error: CLANG_WARNING: bash-5.2/variables.c:4186:13: warning[deadcode.DeadStores]: Although the value stored to 'vlist' is used in the enclosing expression, the value is never actually read from 'vlist' # 4184| { # 4185| if (vlist == 0) # 4186|-> return (vlist = vlist_alloc (n)); # 4187| if (n > vlist->list_size) # 4188| { Error: CLANG_WARNING: bash-5.2/variables.c:4440:3: warning[deadcode.DeadStores]: Value stored to 'vc' is never read # 4438| VAR_CONTEXT *vc; # 4439| # 4440|-> vc = shell_variables; # 4441| for (vc = shell_variables; vc; vc = vc->down) # 4442| if (vc_isfuncenv (vc) && vc->scope == variable_context) Error: COMPILER_WARNING (CWE-563): bash-5.2/variables.c: scope_hint: In function ‘push_posix_temp_var’ bash-5.2/variables.c:4556:15: warning[-Wunused-but-set-variable]: variable ‘binding_table’ set but not used # 4556 | HASH_TABLE *binding_table; # | ^~~~~~~~~~~~~ # 4554| { # 4555| SHELL_VAR *var, *v; # 4556|-> HASH_TABLE *binding_table; # 4557| # 4558| var = (SHELL_VAR *)data; Error: CLANG_WARNING: bash-5.2/variables.c:4572:3: warning[deadcode.DeadStores]: Value stored to 'binding_table' is never read # 4570| Set binding_table appropriately. It doesn't matter whether it's correct # 4571| if the variable is local, only that it's not global_variables->table */ # 4572|-> binding_table = v->context ? shell_variables->table : global_variables->table; # 4573| # 4574| /* global variables are no longer temporary and don't need propagating. */ Error: COMPILER_WARNING (CWE-563): bash-5.2/variables.c: scope_hint: In function ‘mk_env_string’ bash-5.2/variables.c:4760:15: warning[-Wunused-variable]: unused variable ‘isarray’ # 4760 | int isfunc, isarray; # | ^~~~~~~ # 4758| size_t name_len, value_len; # 4759| char *p, *q, *t; # 4760|-> int isfunc, isarray; # 4761| # 4762| name_len = strlen (name); Error: COMPILER_WARNING (CWE-569): bash-5.2/variables.c: scope_hint: In function ‘make_env_array_from_var_list’ bash-5.2/variables.c:4896:31: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 4896 | for (i = 0, list_index = 0; var = vars[i]; i++) # | ^~~ # 4894| list = strvec_create ((1 + strvec_len ((char **)vars))); # 4895| # 4896|-> for (i = 0, list_index = 0; var = vars[i]; i++) # 4897| { # 4898| #if defined (__CYGWIN__) Error: CLANG_WARNING: bash-5.2/variables.c:5132:40: warning[core.NullDereference]: Array access (from variable 'export_env') results in a null pointer dereference # 5130| environ = export_env; # 5131| } # 5132|-> export_env[export_env_index = 0] = (char *)NULL; # 5133| # 5134| /* Make a dummy variable context from the temporary_env, stick it on Error: COMPILER_WARNING (CWE-569): bash-5.2/variables.c: scope_hint: In function ‘pop_var_context’ bash-5.2/variables.c:5420:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 5420 | if (ret = vcxt->down) # | ^~~ # 5418| } # 5419| # 5420|-> if (ret = vcxt->down) # 5421| { # 5422| ret->up = (VAR_CONTEXT *)NULL; Error: COMPILER_WARNING (CWE-563): bash-5.2/variables.c: scope_hint: In function ‘pop_scope’ bash-5.2/variables.c:5520:7: warning[-Wunused-but-set-variable]: variable ‘is_bltinenv’ set but not used # 5520 | int is_bltinenv; # | ^~~~~~~~~~~ # 5518| { # 5519| VAR_CONTEXT *vcxt, *ret; # 5520|-> int is_bltinenv; # 5521| # 5522| vcxt = shell_variables; Error: CLANG_WARNING: bash-5.2/variables.c:5528:3: warning[deadcode.DeadStores]: Value stored to 'is_bltinenv' is never read # 5526| return; # 5527| } # 5528|-> is_bltinenv = vc_isbltnenv (vcxt); /* XXX - for later */ # 5529| # 5530| ret = vcxt->down; Error: COMPILER_WARNING (CWE-569): bash-5.2/variables.c: scope_hint: In function ‘sv_history_control’ bash-5.2/variables.c:6179:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 6179 | while (val = extract_colon_unit (temp, &tptr)) # | ^~~ # 6177| # 6178| tptr = 0; # 6179|-> while (val = extract_colon_unit (temp, &tptr)) # 6180| { # 6181| if (STREQ (val, "ignorespace")) Error: COMPILER_WARNING (CWE-569): bash-5.2/variables.c: scope_hint: In function ‘sv_histtimefmt’ bash-5.2/variables.c:6228:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value # 6228 | if (v = find_variable (name)) # | ^ # 6226| SHELL_VAR *v; # 6227| # 6228|-> if (v = find_variable (name)) # 6229| { # 6230| if (history_comment_char == 0) Error: GCC_ANALYZER_WARNING (CWE-476): bash-5.2/shell.h:31: included_from: Included from here. bash-5.2/arrayfunc.c:32: included_from: Included from here. bash-5.2/arrayfunc.c: scope_hint: In function ‘assign_compound_array_list’ bash-5.2/variables.h:144:41: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘var’ bash-5.2/arrayfunc.c:731:7: note: in expansion of macro ‘assoc_p’ bash-5.2/arrayfunc.c:731:7: note: in expansion of macro ‘assoc_p’ bash-5.2/arrayfunc.c:731:7: note: in expansion of macro ‘assoc_p’ # 142| #define integer_p(var) ((((var)->attributes) & (att_integer))) # 143| #define local_p(var) ((((var)->attributes) & (att_local))) # 144|-> #define assoc_p(var) ((((var)->attributes) & (att_assoc))) # 145| #define trace_p(var) ((((var)->attributes) & (att_trace))) # 146| #define uppercase_p(var) ((((var)->attributes) & (att_uppercase))) Error: COMPILER_WARNING: bash-5.2/xmalloc.c:135:20: warning[-Walloc-size-larger-than=]: argument 2 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807 # 135 | temp = pointer ? realloc (pointer, bytes) : malloc (bytes); # | ^ /usr/include/stdlib.h: scope_hint: In function ‘shell_getc’ /usr/include/stdlib.h:683:14: note: in a call to allocation function ‘realloc’ declared here # 683 | extern void *realloc (void *__ptr, size_t __size) # | ^ # 133| # 134| FINDBRK(); # 135|-> temp = pointer ? realloc (pointer, bytes) : malloc (bytes); # 136| # 137| if (temp == 0) Error: COMPILER_WARNING: bash-5.2/xmalloc.c:135:47: warning[-Walloc-size-larger-than=]: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807 # 135 | temp = pointer ? realloc (pointer, bytes) : malloc (bytes); # | ^ /usr/include/stdlib.h: scope_hint: In function ‘shell_getc’ /usr/include/stdlib.h:672:14: note: in a call to allocation function ‘malloc’ declared here # 672 | extern void *malloc (size_t __size) __THROW __attribute_malloc__ # | ^ # 133| # 134| FINDBRK(); # 135|-> temp = pointer ? realloc (pointer, bytes) : malloc (bytes); # 136| # 137| if (temp == 0) Error: CPPCHECK_WARNING: bash-5.2/y.tab.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.