Task #119220 - git-2.53.0-1.fc44/scan-results.err
back to task #119220download
Error: SHELLCHECK_WARNING (CWE-569):
/usr/bin/gitk:10:5: error[SC1035]: You need a space after the [ and before the ].
# 8| # either version 2, or (at your option) any later version.
# 9|
# 10|-> if {[catch {package require Tcl 8.6-} err]} {
# 11| catch {wm withdraw .}
# 12| tk_messageBox \
Error: SHELLCHECK_WARNING:
/usr/bin/gitk:10:5: error[SC1054]: You need a space after the '{'.
# 8| # either version 2, or (at your option) any later version.
# 9|
# 10|-> if {[catch {package require Tcl 8.6-} err]} {
# 11| catch {wm withdraw .}
# 12| tk_messageBox \
Error: SHELLCHECK_WARNING (CWE-398):
/usr/bin/gitk:10:5: error[SC1073]: Couldn't parse this test expression. Fix to allow more checks.
# 8| # either version 2, or (at your option) any later version.
# 9|
# 10|-> if {[catch {package require Tcl 8.6-} err]} {
# 11| catch {wm withdraw .}
# 12| tk_messageBox \
Error: SHELLCHECK_WARNING (CWE-398):
/usr/bin/gitk:10:12: error[SC1072]: Expected test to end here (don't wrap commands in []/[[]]). Fix any mentioned problems and try again.
# 8| # either version 2, or (at your option) any later version.
# 9|
# 10|-> if {[catch {package require Tcl 8.6-} err]} {
# 11| catch {wm withdraw .}
# 12| tk_messageBox \
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-difftool--helper:8:1: warning[SC2034]: TOOL_MODE appears unused. Verify use (or export if used externally).
# 6| # Copyright (c) 2009, 2010 David Aguilar
# 7|
# 8|-> TOOL_MODE=diff
# 9| . git-mergetool--lib
# 10|
Error: SHELLCHECK_WARNING (CWE-456):
/usr/libexec/git-core/git-difftool--helper:8:1: warning[SC2209]: Use var=$(command) to assign output (or quote to assign string).
# 6| # Copyright (c) 2009, 2010 David Aguilar
# 7|
# 8|-> TOOL_MODE=diff
# 9| . git-mergetool--lib
# 10|
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-difftool--helper:86:2: warning[SC2034]: LOCAL appears unused. Verify use (or export if used externally).
# 84| if test -n "$GIT_DIFFTOOL_DIRDIFF"
# 85| then
# 86|-> LOCAL="$1"
# 87| REMOTE="$2"
# 88| initialize_merge_tool "$merge_tool" || exit 1
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-difftool--helper:87:2: warning[SC2034]: REMOTE appears unused. Verify use (or export if used externally).
# 85| then
# 86| LOCAL="$1"
# 87|-> REMOTE="$2"
# 88| initialize_merge_tool "$merge_tool" || exit 1
# 89| run_merge_tool "$merge_tool" false
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-filter-branch:100:1: warning[SC2034]: USAGE appears unused. Verify use (or export if used externally).
# 98| fi
# 99|
# 100|-> USAGE="[--setup <command>] [--subdirectory-filter <directory>] [--env-filter <command>]
# 101| [--tree-filter <command>] [--index-filter <command>]
# 102| [--parent-filter <command>] [--msg-filter <command>]
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-filter-branch:108:1: warning[SC2034]: OPTIONS_SPEC appears unused. Verify use (or export if used externally).
# 106| [--] [<rev-list options>...]"
# 107|
# 108|-> OPTIONS_SPEC=
# 109| . git-sh-setup
# 110|
Error: SHELLCHECK_WARNING (CWE-456):
/usr/libexec/git-core/git-filter-branch:121:1: warning[SC2209]: Use var=$(command) to assign output (or quote to assign string).
# 119| filter_index=
# 120| filter_parent=
# 121|-> filter_msg=cat
# 122| filter_commit=
# 123| filter_tag_name=
Error: SHELLCHECK_WARNING (CWE-480):
/usr/libexec/git-core/git-filter-branch:368:10: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 366| git_filter_branch__commit_count=0
# 367|
# 368|-> progress= start_timestamp=
# 369| if date '+%s' 2>/dev/null | grep -q '^[0-9][0-9]*$'
# 370| then
Error: SHELLCHECK_WARNING (CWE-156):
/usr/libexec/git-core/git-filter-branch:498:28: warning[SC2046]: Quote this to prevent word splitting.
# 496| test -f "$workdir"/../map/$sha1 && continue
# 497| ancestor=$(git rev-list --simplify-merges -1 "$ref" "$@")
# 498|-> test "$ancestor" && echo $(map $ancestor) >"$workdir"/../map/$sha1
# 499| done < "$tempdir"/heads
# 500| fi
Error: SHELLCHECK_WARNING (CWE-156):
/usr/libexec/git-core/git-filter-branch:527:12: warning[SC2046]: Quote this to prevent word splitting.
# 525| if ! git update-ref -m "filter-branch: rewrite" \
# 526| "$ref" $rewritten $sha1 2>/dev/null; then
# 527|-> if test $(git cat-file -t "$ref") = tag; then
# 528| if test -z "$filter_tag_name"; then
# 529| warn "WARNING: You said to rewrite tagged commits, but not the corresponding tag."
Error: SHELLCHECK_WARNING (CWE-477):
/usr/libexec/git-core/git-filter-branch:551:28: warning[SC2166]: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
# 549| ref="${ref#refs/tags/}"
# 550| # XXX: Rewrite tagged trees as well?
# 551|-> if [ "$type" != "commit" -a "$type" != "tag" ]; then
# 552| continue;
# 553| fi
Error: SHELLCHECK_WARNING (CWE-569):
/usr/libexec/git-core/git-filter-branch:558:37: warning[SC1083]: This { is literal. Check expression (missing ;/\n?) or quote it.
# 556| # Dereference to a commit
# 557| sha1t="$sha1"
# 558|-> sha1="$(git rev-parse -q "$sha1"^{commit})" || continue
# 559| fi
# 560|
Error: SHELLCHECK_WARNING (CWE-569):
/usr/libexec/git-core/git-filter-branch:558:44: warning[SC1083]: This } is literal. Check expression (missing ;/\n?) or quote it.
# 556| # Dereference to a commit
# 557| sha1t="$sha1"
# 558|-> sha1="$(git rev-parse -q "$sha1"^{commit})" || continue
# 559| fi
# 560|
Error: SHELLCHECK_WARNING (CWE-252):
/usr/libexec/git-core/git-filter-branch:656:1: warning[SC2164]: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
# 654| fi
# 655|
# 656|-> cd "$orig_dir"
# 657| rm -rf "$tempdir"
# 658|
Error: SHELLCHECK_WARNING (CWE-561):
/usr/libexec/git-core/git-gui:10:2: warning[SC2093]: Remove "exec " if script should continue after this command.
# 8| fi; \
# 9| argv0=$0; \
# 10|-> exec 'wish' "$argv0" -- "$@"
# 11|
# 12| set appvers {0.21.0.257.g1a729}
Error: SHELLCHECK_WARNING (CWE-456):
/usr/libexec/git-core/git-gui:12:5: warning[SC2121]: To assign a variable, use just 'var=value', no 'set ..'.
# 10| exec 'wish' "$argv0" -- "$@"
# 11|
# 12|-> set appvers {0.21.0.257.g1a729}
# 13| set copyright [string map [list (c) \u00a9] {
# 14| Copyright (c) 2006-2010 Shawn Pearce, et. al.
Error: SHELLCHECK_WARNING (CWE-569):
/usr/libexec/git-core/git-gui:12:13: warning[SC1083]: This { is literal. Check expression (missing ;/\n?) or quote it.
# 10| exec 'wish' "$argv0" -- "$@"
# 11|
# 12|-> set appvers {0.21.0.257.g1a729}
# 13| set copyright [string map [list (c) \u00a9] {
# 14| Copyright (c) 2006-2010 Shawn Pearce, et. al.
Error: SHELLCHECK_WARNING (CWE-569):
/usr/libexec/git-core/git-gui:12:31: warning[SC1083]: This } is literal. Check expression (missing ;/\n?) or quote it.
# 10| exec 'wish' "$argv0" -- "$@"
# 11|
# 12|-> set appvers {0.21.0.257.g1a729}
# 13| set copyright [string map [list (c) \u00a9] {
# 14| Copyright (c) 2006-2010 Shawn Pearce, et. al.
Error: SHELLCHECK_WARNING (CWE-456):
/usr/libexec/git-core/git-gui:13:5: warning[SC2121]: To assign a variable, use just 'var=value', no 'set ..'.
# 11|
# 12| set appvers {0.21.0.257.g1a729}
# 13|-> set copyright [string map [list (c) \u00a9] {
# 14| Copyright (c) 2006-2010 Shawn Pearce, et. al.
# 15|
Error: SHELLCHECK_WARNING (CWE-398):
/usr/libexec/git-core/git-gui:13:33: error[SC1036]: '(' is invalid here. Did you forget to escape it?
# 11|
# 12| set appvers {0.21.0.257.g1a729}
# 13|-> set copyright [string map [list (c) \u00a9] {
# 14| Copyright (c) 2006-2010 Shawn Pearce, et. al.
# 15|
Error: SHELLCHECK_WARNING (CWE-398):
/usr/libexec/git-core/git-gui:13:33: error[SC1088]: Parsing stopped here. Invalid use of parentheses?
# 11|
# 12| set appvers {0.21.0.257.g1a729}
# 13|-> set copyright [string map [list (c) \u00a9] {
# 14| Copyright (c) 2006-2010 Shawn Pearce, et. al.
# 15|
Error: SHELLCHECK_WARNING:
/usr/libexec/git-core/git-gui--askpass:14:1: error[SC1049]: Did you forget the 'then' for this 'if'?
# 12| set rc 255
# 13|
# 14|-> if {$argc < 1} {
# 15| set prompt "Enter your OpenSSH passphrase:"
# 16| } else {
Error: SHELLCHECK_WARNING (CWE-398):
/usr/libexec/git-core/git-gui--askpass:14:1: error[SC1073]: Couldn't parse this if expression. Fix to allow more checks.
# 12| set rc 255
# 13|
# 14|-> if {$argc < 1} {
# 15| set prompt "Enter your OpenSSH passphrase:"
# 16| } else {
Error: SHELLCHECK_WARNING:
/usr/libexec/git-core/git-gui--askpass:14:5: error[SC1054]: You need a space after the '{'.
# 12| set rc 255
# 13|
# 14|-> if {$argc < 1} {
# 15| set prompt "Enter your OpenSSH passphrase:"
# 16| } else {
Error: SHELLCHECK_WARNING (CWE-569):
/usr/libexec/git-core/git-gui--askpass:14:14: warning[SC1083]: This } is literal. Check expression (missing ;/\n?) or quote it.
# 12| set rc 255
# 13|
# 14|-> if {$argc < 1} {
# 15| set prompt "Enter your OpenSSH passphrase:"
# 16| } else {
Error: SHELLCHECK_WARNING (CWE-569):
/usr/libexec/git-core/git-gui--askpass:14:16: warning[SC1083]: This { is literal. Check expression (missing ;/\n?) or quote it.
# 12| set rc 255
# 13|
# 14|-> if {$argc < 1} {
# 15| set prompt "Enter your OpenSSH passphrase:"
# 16| } else {
Error: SHELLCHECK_WARNING:
/usr/libexec/git-core/git-gui--askpass:16:3: error[SC1050]: Expected 'then'.
# 14| if {$argc < 1} {
# 15| set prompt "Enter your OpenSSH passphrase:"
# 16|-> } else {
# 17| set prompt [join $argv " "]
# 18| if {[regexp -nocase {\(yes\/no\)\?\s*$} $prompt]} {
Error: SHELLCHECK_WARNING (CWE-398):
/usr/libexec/git-core/git-gui--askpass:16:8: error[SC1072]: Unexpected . Fix any mentioned problems and try again.
# 14| if {$argc < 1} {
# 15| set prompt "Enter your OpenSSH passphrase:"
# 16|-> } else {
# 17| set prompt [join $argv " "]
# 18| if {[regexp -nocase {\(yes\/no\)\?\s*$} $prompt]} {
Error: SHELLCHECK_WARNING:
/usr/libexec/git-core/git-gui--askyesno:15:5: error[SC1054]: You need a space after the '{'.
# 13| set NS {}
# 14| set use_ttk [package vsatisfies [package provide Tk] 8.5]
# 15|-> if {$use_ttk} {
# 16| set NS ttk
# 17| }
Error: SHELLCHECK_WARNING (CWE-569):
/usr/libexec/git-core/git-gui--askyesno:15:13: warning[SC1083]: This } is literal. Check expression (missing ;/\n?) or quote it.
# 13| set NS {}
# 14| set use_ttk [package vsatisfies [package provide Tk] 8.5]
# 15|-> if {$use_ttk} {
# 16| set NS ttk
# 17| }
Error: SHELLCHECK_WARNING (CWE-569):
/usr/libexec/git-core/git-gui--askyesno:15:15: warning[SC1083]: This { is literal. Check expression (missing ;/\n?) or quote it.
# 13| set NS {}
# 14| set use_ttk [package vsatisfies [package provide Tk] 8.5]
# 15|-> if {$use_ttk} {
# 16| set NS ttk
# 17| }
Error: SHELLCHECK_WARNING:
/usr/libexec/git-core/git-gui--askyesno:20:1: error[SC1049]: Did you forget the 'then' for this 'if'?
# 18|
# 19| set title "Question?"
# 20|-> if {$argc < 1} {
# 21| puts stderr "Usage: $argv0 <question>"
# 22| exit 1
Error: SHELLCHECK_WARNING (CWE-398):
/usr/libexec/git-core/git-gui--askyesno:20:1: error[SC1073]: Couldn't parse this if expression. Fix to allow more checks.
# 18|
# 19| set title "Question?"
# 20|-> if {$argc < 1} {
# 21| puts stderr "Usage: $argv0 <question>"
# 22| exit 1
Error: SHELLCHECK_WARNING:
/usr/libexec/git-core/git-gui--askyesno:20:5: error[SC1054]: You need a space after the '{'.
# 18|
# 19| set title "Question?"
# 20|-> if {$argc < 1} {
# 21| puts stderr "Usage: $argv0 <question>"
# 22| exit 1
Error: SHELLCHECK_WARNING (CWE-569):
/usr/libexec/git-core/git-gui--askyesno:20:14: warning[SC1083]: This } is literal. Check expression (missing ;/\n?) or quote it.
# 18|
# 19| set title "Question?"
# 20|-> if {$argc < 1} {
# 21| puts stderr "Usage: $argv0 <question>"
# 22| exit 1
Error: SHELLCHECK_WARNING (CWE-569):
/usr/libexec/git-core/git-gui--askyesno:20:16: warning[SC1083]: This { is literal. Check expression (missing ;/\n?) or quote it.
# 18|
# 19| set title "Question?"
# 20|-> if {$argc < 1} {
# 21| puts stderr "Usage: $argv0 <question>"
# 22| exit 1
Error: SHELLCHECK_WARNING:
/usr/libexec/git-core/git-gui--askyesno:23:3: error[SC1050]: Expected 'then'.
# 21| puts stderr "Usage: $argv0 <question>"
# 22| exit 1
# 23|-> } else {
# 24| if {$argc > 2 && [lindex $argv 0] == "--title"} {
# 25| set title [lindex $argv 1]
Error: SHELLCHECK_WARNING (CWE-398):
/usr/libexec/git-core/git-gui--askyesno:23:8: error[SC1072]: Unexpected . Fix any mentioned problems and try again.
# 21| puts stderr "Usage: $argv0 <question>"
# 22| exit 1
# 23|-> } else {
# 24| if {$argc > 2 && [lindex $argv 0] == "--title"} {
# 25| set title [lindex $argv 1]
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-instaweb:7:1: warning[SC2034]: OPTIONS_KEEPDASHDASH appears unused. Verify use (or export if used externally).
# 5|
# 6| PERL='/usr/bin/perl'
# 7|-> OPTIONS_KEEPDASHDASH=
# 8| OPTIONS_STUCKLONG=
# 9| OPTIONS_SPEC="\
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-instaweb:8:1: warning[SC2034]: OPTIONS_STUCKLONG appears unused. Verify use (or export if used externally).
# 6| PERL='/usr/bin/perl'
# 7| OPTIONS_KEEPDASHDASH=
# 8|-> OPTIONS_STUCKLONG=
# 9| OPTIONS_SPEC="\
# 10| git instaweb [options] (--start | --stop | --restart)
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-instaweb:9:1: warning[SC2034]: OPTIONS_SPEC appears unused. Verify use (or export if used externally).
# 7| OPTIONS_KEEPDASHDASH=
# 8| OPTIONS_STUCKLONG=
# 9|-> OPTIONS_SPEC="\
# 10| git instaweb [options] (--start | --stop | --restart)
# 11| --
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-instaweb:23:1: warning[SC2034]: SUBDIRECTORY_OK appears unused. Verify use (or export if used externally).
# 21| "
# 22|
# 23|-> SUBDIRECTORY_OK=Yes
# 24| . git-sh-setup
# 25|
Error: SHELLCHECK_WARNING (CWE-156):
/usr/libexec/git-core/git-instaweb:146:34: warning[SC2046]: Quote this to prevent word splitting.
# 144|
# 145| stop_httpd () {
# 146|-> test -f "$fqgitdir/pid" && kill $(cat "$fqgitdir/pid")
# 147| rm -f "$fqgitdir/pid"
# 148| }
Error: SHELLCHECK_WARNING (CWE-457):
/usr/libexec/git-core/git-instaweb:562:27: warning[SC2154]: fd is referenced but not assigned.
# 560| };
# 561| # gitweb currently doesn't work with $SIG{CHLD} set to 'IGNORE',
# 562|-> # because it uses 'close $fd or die...' on piped filehandle $fh
# 563| # (which causes the parent process to wait for child to finish).
# 564| enable_if { \$SIG{'CHLD'} eq 'IGNORE' } sub {
Error: SHELLCHECK_WARNING (CWE-457):
/usr/libexec/git-core/git-instaweb:562:62: warning[SC2154]: fh is referenced but not assigned.
# 560| };
# 561| # gitweb currently doesn't work with $SIG{CHLD} set to 'IGNORE',
# 562|-> # because it uses 'close $fd or die...' on piped filehandle $fh
# 563| # (which causes the parent process to wait for child to finish).
# 564| enable_if { \$SIG{'CHLD'} eq 'IGNORE' } sub {
Error: SHELLCHECK_WARNING (CWE-480):
/usr/libexec/git-core/git-merge-octopus:14:7: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 12|
# 13| # The first parameters up to -- are merge bases; the rest are heads.
# 14|-> bases= head= remotes= sep_seen=
# 15| for arg
# 16| do
Error: SHELLCHECK_WARNING (CWE-480):
/usr/libexec/git-core/git-merge-octopus:14:13: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 12|
# 13| # The first parameters up to -- are merge bases; the rest are heads.
# 14|-> bases= head= remotes= sep_seen=
# 15| for arg
# 16| do
Error: SHELLCHECK_WARNING (CWE-480):
/usr/libexec/git-core/git-merge-octopus:14:22: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 12|
# 13| # The first parameters up to -- are merge bases; the rest are heads.
# 14|-> bases= head= remotes= sep_seen=
# 15| for arg
# 16| do
Error: SHELLCHECK_WARNING (CWE-569):
/usr/libexec/git-core/git-merge-octopus:66:21: warning[SC1083]: This { is literal. Check expression (missing ;/\n?) or quote it.
# 64| esac
# 65|
# 66|-> eval pretty_name=\${GITHEAD_$SHA1:-$SHA1}
# 67| if test "$SHA1" = "$pretty_name"
# 68| then
Error: SHELLCHECK_WARNING (CWE-569):
/usr/libexec/git-core/git-merge-octopus:66:42: warning[SC1083]: This } is literal. Check expression (missing ;/\n?) or quote it.
# 64| esac
# 65|
# 66|-> eval pretty_name=\${GITHEAD_$SHA1:-$SHA1}
# 67| if test "$SHA1" = "$pretty_name"
# 68| then
Error: SHELLCHECK_WARNING (CWE-457):
/usr/libexec/git-core/git-merge-octopus:67:21: warning[SC2154]: pretty_name is referenced but not assigned.
# 65|
# 66| eval pretty_name=\${GITHEAD_$SHA1:-$SHA1}
# 67|-> if test "$SHA1" = "$pretty_name"
# 68| then
# 69| SHA1_UP="$(echo "$SHA1" | tr a-z A-Z)"
Error: SHELLCHECK_WARNING (CWE-569):
/usr/libexec/git-core/git-merge-octopus:70:22: warning[SC1083]: This { is literal. Check expression (missing ;/\n?) or quote it.
# 68| then
# 69| SHA1_UP="$(echo "$SHA1" | tr a-z A-Z)"
# 70|-> eval pretty_name=\${GITHEAD_$SHA1_UP:-$pretty_name}
# 71| fi
# 72| common=$(git merge-base --all $SHA1 $MRC) ||
Error: SHELLCHECK_WARNING (CWE-569):
/usr/libexec/git-core/git-merge-octopus:70:53: warning[SC1083]: This } is literal. Check expression (missing ;/\n?) or quote it.
# 68| then
# 69| SHA1_UP="$(echo "$SHA1" | tr a-z A-Z)"
# 70|-> eval pretty_name=\${GITHEAD_$SHA1_UP:-$pretty_name}
# 71| fi
# 72| common=$(git merge-base --all $SHA1 $MRC) ||
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-merge-one-file:25:1: warning[SC2034]: SUBDIRECTORY_OK appears unused. Verify use (or export if used externally).
# 23| Blob ids and modes should be empty for missing files."
# 24|
# 25|-> SUBDIRECTORY_OK=Yes
# 26| . git-sh-setup
# 27| cd_to_toplevel
Error: SHELLCHECK_WARNING (CWE-156):
/usr/libexec/git-core/git-merge-one-file:123:26: warning[SC2046]: Quote this to prevent word splitting.
# 121| '')
# 122| echo "Added $4 in both, but differently."
# 123|-> orig=$(git unpack-file $(git hash-object /dev/null))
# 124| ;;
# 125| *)
Error: SHELLCHECK_WARNING (CWE-480):
/usr/libexec/git-core/git-merge-resolve:19:7: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 17|
# 18| # The first parameters up to -- are merge bases; the rest are heads.
# 19|-> bases= head= remotes= sep_seen=
# 20| for arg
# 21| do
Error: SHELLCHECK_WARNING (CWE-480):
/usr/libexec/git-core/git-merge-resolve:19:13: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 17|
# 18| # The first parameters up to -- are merge bases; the rest are heads.
# 19|-> bases= head= remotes= sep_seen=
# 20| for arg
# 21| do
Error: SHELLCHECK_WARNING (CWE-480):
/usr/libexec/git-core/git-merge-resolve:19:22: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 17|
# 18| # The first parameters up to -- are merge bases; the rest are heads.
# 19|-> bases= head= remotes= sep_seen=
# 20| for arg
# 21| do
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-merge-resolve:53:4: warning[SC2034]: result_tree appears unused. Verify use (or export if used externally).
# 51| git read-tree -u -m --aggressive $bases $head $remotes || exit 2
# 52| echo "Trying simple merge."
# 53|-> if result_tree=$(git write-tree 2>/dev/null)
# 54| then
# 55| exit 0
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-mergetool:12:1: warning[SC2034]: USAGE appears unused. Verify use (or export if used externally).
# 10| #
# 11|
# 12|-> USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-g|--gui|--no-gui] [-O<orderfile>] [file to merge] ...'
# 13| SUBDIRECTORY_OK=Yes
# 14| NONGIT_OK=Yes
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-mergetool:13:1: warning[SC2034]: SUBDIRECTORY_OK appears unused. Verify use (or export if used externally).
# 11|
# 12| USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-g|--gui|--no-gui] [-O<orderfile>] [file to merge] ...'
# 13|-> SUBDIRECTORY_OK=Yes
# 14| NONGIT_OK=Yes
# 15| OPTIONS_SPEC=
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-mergetool:14:1: warning[SC2034]: NONGIT_OK appears unused. Verify use (or export if used externally).
# 12| USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-g|--gui|--no-gui] [-O<orderfile>] [file to merge] ...'
# 13| SUBDIRECTORY_OK=Yes
# 14|-> NONGIT_OK=Yes
# 15| OPTIONS_SPEC=
# 16| TOOL_MODE=merge
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-mergetool:15:1: warning[SC2034]: OPTIONS_SPEC appears unused. Verify use (or export if used externally).
# 13| SUBDIRECTORY_OK=Yes
# 14| NONGIT_OK=Yes
# 15|-> OPTIONS_SPEC=
# 16| TOOL_MODE=merge
# 17| . git-sh-setup
Error: SHELLCHECK_WARNING (CWE-569):
/usr/libexec/git-core/git-mergetool:238:3: warning[SC2188]: This redirection doesn't have a command. Move to its command (or use 'true' as no-op).
# 236| mv -- "$(git rev-parse --show-cdup)$tmpfile" "$3"
# 237| else
# 238|-> >"$3"
# 239| fi
# 240| }
Error: SHELLCHECK_WARNING (CWE-480):
/usr/libexec/git-core/git-mergetool:293:12: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 291| BASE="$MERGETOOL_TMPDIR/${BASE}_BASE_$$$ext"
# 292|
# 293|-> base_mode= local_mode= remote_mode=
# 294|
# 295| # here, $IFS is just a LF
Error: SHELLCHECK_WARNING (CWE-480):
/usr/libexec/git-core/git-mergetool:293:24: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 291| BASE="$MERGETOOL_TMPDIR/${BASE}_BASE_$$$ext"
# 292|
# 293|-> base_mode= local_mode= remote_mode=
# 294|
# 295| # here, $IFS is just a LF
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-mergetool:462:4: warning[SC2034]: TOOL_MODE appears unused. Verify use (or export if used externally).
# 460| case "$1" in
# 461| --tool-help=*)
# 462|-> TOOL_MODE=${1#--tool-help=}
# 463| show_tool_help
# 464| ;;
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-mergetool:484:4: warning[SC2034]: GIT_MERGETOOL_GUI appears unused. Verify use (or export if used externally).
# 482| ;;
# 483| -g|--gui)
# 484|-> GIT_MERGETOOL_GUI=true
# 485| ;;
# 486| -y|--no-prompt)
Error: SHELLCHECK_WARNING (CWE-156):
/usr/libexec/git-core/git-mergetool:540:10: warning[SC2046]: Quote this to prevent word splitting.
# 538| if test $# -eq 0 && test -e "$GIT_DIR/MERGE_RR"
# 539| then
# 540|-> set -- $(git rerere remaining)
# 541| if test $# -eq 0
# 542| then
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-quiltimport:2:1: warning[SC2034]: OPTIONS_KEEPDASHDASH appears unused. Verify use (or export if used externally).
# 1| #!/usr/bin/sh
# 2|-> OPTIONS_KEEPDASHDASH=
# 3| OPTIONS_STUCKLONG=
# 4| OPTIONS_SPEC="\
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-quiltimport:3:1: warning[SC2034]: OPTIONS_STUCKLONG appears unused. Verify use (or export if used externally).
# 1| #!/usr/bin/sh
# 2| OPTIONS_KEEPDASHDASH=
# 3|-> OPTIONS_STUCKLONG=
# 4| OPTIONS_SPEC="\
# 5| git quiltimport [options]
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-quiltimport:4:1: warning[SC2034]: OPTIONS_SPEC appears unused. Verify use (or export if used externally).
# 2| OPTIONS_KEEPDASHDASH=
# 3| OPTIONS_STUCKLONG=
# 4|-> OPTIONS_SPEC="\
# 5| git quiltimport [options]
# 6| --
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-quiltimport:13:1: warning[SC2034]: SUBDIRECTORY_ON appears unused. Verify use (or export if used externally).
# 11| keep-non-patch Pass -b to git mailinfo
# 12| "
# 13|-> SUBDIRECTORY_ON=Yes
# 14| . git-sh-setup
# 15|
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-request-pull:7:1: warning[SC2034]: SUBDIRECTORY_OK appears unused. Verify use (or export if used externally).
# 5| # at the discretion of Linus Torvalds.
# 6|
# 7|-> SUBDIRECTORY_OK='Yes'
# 8| OPTIONS_KEEPDASHDASH=
# 9| OPTIONS_STUCKLONG=
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-request-pull:8:1: warning[SC2034]: OPTIONS_KEEPDASHDASH appears unused. Verify use (or export if used externally).
# 6|
# 7| SUBDIRECTORY_OK='Yes'
# 8|-> OPTIONS_KEEPDASHDASH=
# 9| OPTIONS_STUCKLONG=
# 10| OPTIONS_SPEC='git request-pull [options] start url [end]
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-request-pull:9:1: warning[SC2034]: OPTIONS_STUCKLONG appears unused. Verify use (or export if used externally).
# 7| SUBDIRECTORY_OK='Yes'
# 8| OPTIONS_KEEPDASHDASH=
# 9|-> OPTIONS_STUCKLONG=
# 10| OPTIONS_SPEC='git request-pull [options] start url [end]
# 11| --
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-request-pull:10:1: warning[SC2034]: OPTIONS_SPEC appears unused. Verify use (or export if used externally).
# 8| OPTIONS_KEEPDASHDASH=
# 9| OPTIONS_STUCKLONG=
# 10|-> OPTIONS_SPEC='git request-pull [options] start url [end]
# 11| --
# 12| p show patch text as well
Error: SHELLCHECK_WARNING (CWE-457):
/usr/libexec/git-core/git-request-pull:72:29: warning[SC2154]: headref is referenced but not assigned (did you mean 'headrev'?).
# 70| # Was it a branch with a description?
# 71| branch_name=${head#refs/heads/}
# 72|-> if test "z$branch_name" = "z$headref" ||
# 73| ! git config "branch.$branch_name.description" >/dev/null
# 74| then
Error: SHELLCHECK_WARNING (CWE-456):
/usr/libexec/git-core/git-request-pull:121:5: warning[SC2121]: To assign a variable, use just 'var=value', no 'set ..'.
# 119| # Find a ref with the same name as $remote that exists at the remote
# 120| # and points to the same commit as the local object.
# 121|-> set fnord $(git ls-remote "$url" | find_matching_ref)
# 122| remote_sha1=$2
# 123| ref=$3
Error: SHELLCHECK_WARNING (CWE-156):
/usr/libexec/git-core/git-request-pull:121:11: warning[SC2046]: Quote this to prevent word splitting.
# 119| # Find a ref with the same name as $remote that exists at the remote
# 120| # and points to the same commit as the local object.
# 121|-> set fnord $(git ls-remote "$url" | find_matching_ref)
# 122| remote_sha1=$2
# 123| ref=$3
Error: SHELLCHECK_WARNING (CWE-156):
/usr/libexec/git-core/git-request-pull:159:9: warning[SC2046]: Quote this to prevent word splitting.
# 157| ----------------------------------------------------------------' $headrev &&
# 158|
# 159|-> if test $(git cat-file -t "$head") = tag
# 160| then
# 161| git cat-file tag "$head" |
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-submodule:8:1: warning[SC2034]: USAGE appears unused. Verify use (or export if used externally).
# 6|
# 7| dashless=$(basename "$0" | sed -e 's/-/ /')
# 8|-> USAGE="[--quiet] [--cached]
# 9| or: $dashless [--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
# 10| or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-submodule:20:1: warning[SC2034]: OPTIONS_SPEC appears unused. Verify use (or export if used externally).
# 18| or: $dashless [--quiet] sync [--recursive] [--] [<path>...]
# 19| or: $dashless [--quiet] absorbgitdirs [--] [<path>...]"
# 20|-> OPTIONS_SPEC=
# 21| SUBDIRECTORY_OK=Yes
# 22| . git-sh-setup
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-submodule:21:1: warning[SC2034]: SUBDIRECTORY_OK appears unused. Verify use (or export if used externally).
# 19| or: $dashless [--quiet] absorbgitdirs [--] [<path>...]"
# 20| OPTIONS_SPEC=
# 21|-> SUBDIRECTORY_OK=Yes
# 22| . git-sh-setup
# 23| require_work_tree
Error: SHELLCHECK_WARNING (CWE-685):
/usr/libexec/git-core/git-subtree:279:1: warning[SC2120]: cache_setup references arguments, but none are ever passed.
# 277|
# 278| # Usage: cache_setup
# 279|-> cache_setup () {
# 280| assert test $# = 0
# 281| cachedir="$GIT_DIR/subtree-cache/$$"
Error: SHELLCHECK_WARNING:
/usr/libexec/git-core/git-subtree:317:2: warning[SC3043]: In POSIX sh, 'local' is undefined.
# 315| check_parents () {
# 316| missed=$(cache_miss "$@") || exit $?
# 317|-> local indent=$(($indent + 1))
# 318| for miss in $missed
# 319| do
Error: SHELLCHECK_WARNING:
/usr/libexec/git-core/git-subtree:413:2: warning[SC3043]: In POSIX sh, 'local' is undefined.
# 411| fi
# 412| debug "Looking for latest squash (dir=$dir, repository=$repository)..."
# 413|-> local indent=$(($indent + 1))
# 414|
# 415| sq=
Error: SHELLCHECK_WARNING:
/usr/libexec/git-core/git-subtree:461:2: warning[SC3043]: In POSIX sh, 'local' is undefined.
# 459| assert test $# -le 3
# 460| debug "Looking for prior splits..."
# 461|-> local indent=$(($indent + 1))
# 462|
# 463| dir="$1"
Error: SHELLCHECK_WARNING:
/usr/libexec/git-core/git-subtree:472:2: warning[SC3043]: In POSIX sh, 'local' is undefined.
# 470| main=
# 471| sub=
# 472|-> local grep_format="^git-subtree-dir: $dir/*\$"
# 473| if test -n "$arg_split_ignore_joins"
# 474| then
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-subtree:639:13: warning[SC2034]: mode appears unused. Verify use (or export if used externally).
# 637| dir="$2"
# 638| git ls-tree "$commit" -- "$dir" |
# 639|-> while read mode type tree name
# 640| do
# 641| assert test "$name" = "$dir"
Error: SHELLCHECK_WARNING (CWE-685):
/usr/libexec/git-core/git-subtree:769:1: warning[SC2120]: ensure_clean references arguments, but none are ever passed.
# 767|
# 768| # Usage: ensure_clean
# 769|-> ensure_clean () {
# 770| assert test $# = 0
# 771| if ! git diff-index HEAD --exit-code --quiet 2>&1
Error: SHELLCHECK_WARNING:
/usr/libexec/git-core/git-subtree:827:2: warning[SC3043]: In POSIX sh, 'local' is undefined.
# 825| process_split_commit () {
# 826| assert test $# = 2
# 827|-> local rev="$1"
# 828| local parents="$2"
# 829|
Error: SHELLCHECK_WARNING:
/usr/libexec/git-core/git-subtree:828:2: warning[SC3043]: In POSIX sh, 'local' is undefined.
# 826| assert test $# = 2
# 827| local rev="$1"
# 828|-> local parents="$2"
# 829|
# 830| if test $indent -eq 0
Error: SHELLCHECK_WARNING:
/usr/libexec/git-core/git-subtree:843:2: warning[SC3043]: In POSIX sh, 'local' is undefined.
# 841|
# 842| debug "Processing commit: $rev"
# 843|-> local indent=$(($indent + 1))
# 844| exists=$(cache_get "$rev") || exit $?
# 845| if test -n "$exists"
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-subtree:996:2: warning[SC2034]: unrevs appears unused. Verify use (or export if used externally).
# 994| fi
# 995|
# 996|-> unrevs="$(find_existing_splits "$dir" "$rev" "$repository")" || exit $?
# 997|
# 998| # We can't restrict rev-list to only $dir here, because some of our
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-web--browse:19:1: warning[SC2034]: USAGE appears unused. Verify use (or export if used externally).
# 17| #
# 18|
# 19|-> USAGE='[--browser=browser|--tool=browser] [--config=conf.var] url/file ...'
# 20|
# 21| # This must be capable of running outside of git directory, so
Error: SHELLCHECK_WARNING (CWE-563):
/usr/libexec/git-core/git-web--browse:23:1: warning[SC2034]: NONGIT_OK appears unused. Verify use (or export if used externally).
# 21| # This must be capable of running outside of git directory, so
# 22| # the vanilla git-sh-setup should not be used.
# 23|-> NONGIT_OK=Yes
# 24| . git-sh-setup
# 25|
Error: SHELLCHECK_WARNING (CWE-140):
/usr/share/doc/git/contrib/completion/git-completion.bash:388:13: warning[SC2206]: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.
# 386| local IFS=$'\n'
# 387|
# 388|-> COMPREPLY=($1)
# 389| }
# 390|
Error: SHELLCHECK_WARNING (CWE-140):
/usr/share/doc/git/contrib/completion/git-completion.bash:401:14: warning[SC2206]: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.
# 399| local IFS=$'\n'
# 400|
# 401|-> COMPREPLY+=($1)
# 402| }
# 403|
Error: SHELLCHECK_WARNING (CWE-569):
/usr/share/doc/git/contrib/completion/git-completion.bash:476:10: error[SC2296]: Parameter expansions can't start with (. Double check syntax.
# 474| # the completion script.
# 475| if [[ -n ${ZSH_VERSION-} ]]; then
# 476|-> unset ${(M)${(k)parameters[@]}:#__gitcomp_builtin_*} 2>/dev/null
# 477| else
# 478| unset $(compgen -v __gitcomp_builtin_)
Error: SHELLCHECK_WARNING (CWE-569):
/usr/share/doc/git/contrib/completion/git-completion.bash:476:15: error[SC2296]: Parameter expansions can't start with (. Double check syntax.
# 474| # the completion script.
# 475| if [[ -n ${ZSH_VERSION-} ]]; then
# 476|-> unset ${(M)${(k)parameters[@]}:#__gitcomp_builtin_*} 2>/dev/null
# 477| else
# 478| unset $(compgen -v __gitcomp_builtin_)
Error: SHELLCHECK_WARNING (CWE-156):
/usr/share/doc/git/contrib/completion/git-completion.bash:478:8: warning[SC2046]: Quote this to prevent word splitting.
# 476| unset ${(M)${(k)parameters[@]}:#__gitcomp_builtin_*} 2>/dev/null
# 477| else
# 478|-> unset $(compgen -v __gitcomp_builtin_)
# 479| fi
# 480|
Error: SHELLCHECK_WARNING (CWE-140):
/usr/share/doc/git/contrib/completion/git-completion.bash:573:13: warning[SC2206]: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.
# 571| local IFS=$'\n'
# 572|
# 573|-> COMPREPLY=($1)
# 574|
# 575| # use a hack to enable file mode in bash < 4
Error: SHELLCHECK_WARNING:
/usr/share/doc/git/contrib/completion/git-completion.bash:929:9: warning[SC2194]: This word is constant. Did you forget the $ on a variable?
# 927| *)
# 928| if [ "$list_refs_from" = remote ]; then
# 929|-> case "HEAD" in
# 930| $match*|$umatch*) echo "${pfx}HEAD$sfx" ;;
# 931| esac
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/doc/git/contrib/completion/git-completion.bash:932:10: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 930| $match*|$umatch*) echo "${pfx}HEAD$sfx" ;;
# 931| esac
# 932|-> local strip="$(__git_count_path_components "refs/remotes/$remote")"
# 933| __git for-each-ref --format="$fer_pfx%(refname:strip=$strip)$sfx" \
# 934| ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
Error: SHELLCHECK_WARNING:
/usr/share/doc/git/contrib/completion/git-completion.bash:939:9: warning[SC2194]: This word is constant. Did you forget the $ on a variable?
# 937| else
# 938| local query_symref
# 939|-> case "HEAD" in
# 940| $match*|$umatch*) query_symref="HEAD" ;;
# 941| esac
Error: SHELLCHECK_WARNING (CWE-480):
/usr/share/doc/git/contrib/completion/git-completion.bash:974:15: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 972| __git_complete_refs ()
# 973| {
# 974|-> local remote= dwim= pfx= cur_="$cur" sfx=" " mode="refs"
# 975|
# 976| while test $# != 0; do
Error: SHELLCHECK_WARNING (CWE-480):
/usr/share/doc/git/contrib/completion/git-completion.bash:974:21: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 972| __git_complete_refs ()
# 973| {
# 974|-> local remote= dwim= pfx= cur_="$cur" sfx=" " mode="refs"
# 975|
# 976| while test $# != 0; do
Error: SHELLCHECK_WARNING (CWE-480):
/usr/share/doc/git/contrib/completion/git-completion.bash:974:26: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 972| __git_complete_refs ()
# 973| {
# 974|-> local remote= dwim= pfx= cur_="$cur" sfx=" " mode="refs"
# 975|
# 976| while test $# != 0; do
Error: SHELLCHECK_WARNING (CWE-563):
/usr/share/doc/git/contrib/completion/git-completion.bash:1042:16: warning[SC2034]: hash appears unused. Verify use (or export if used externally).
# 1040| local i hash
# 1041| __git ls-remote "$1" 'refs/heads/*' | \
# 1042|-> while read -r hash i; do
# 1043| echo "$i:refs/remotes/$1/${i#refs/heads/}"
# 1044| done
Error: SHELLCHECK_WARNING (CWE-480):
/usr/share/doc/git/contrib/completion/git-completion.bash:1282:25: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 1280| __git_aliased_command ()
# 1281| {
# 1282|-> local cur=$1 last list= word cmdline
# 1283|
# 1284| while [[ -n "$cur" ]]; do
Error: SHELLCHECK_WARNING (CWE-569):
/usr/share/doc/git/contrib/completion/git-completion.bash:1306:4: warning[SC1083]: This { is literal. Check expression (missing ;/\n?) or quote it.
# 1304| git) : git itself ;;
# 1305| \(\)) : skip parens of shell function definition ;;
# 1306|-> {) : skip start of shell helper function ;;
# 1307| :) : skip null command ;;
# 1308| \'*) : skip opening quote after sh -c ;;
Error: SHELLCHECK_WARNING (CWE-480):
/usr/share/doc/git/contrib/completion/git-completion.bash:1406:15: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 1404| {
# 1405| local c short_opt long_opt val
# 1406|-> local result= values config_key word
# 1407|
# 1408| short_opt="$1"
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/doc/git/contrib/completion/git-completion.bash:1595:8: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 1593| local all_subcommands="$completable_subcommands view"
# 1594|
# 1595|-> local subcommand="$(__git_find_on_cmdline "$all_subcommands")"
# 1596|
# 1597| if [ -z "$subcommand" ]; then
Error: SHELLCHECK_WARNING (CWE-477):
/usr/share/doc/git/contrib/completion/git-completion.bash:1660:30: warning[SC2166]: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
# 1658| ;;
# 1659| *)
# 1660|-> if [ $only_local_ref = "y" -a $has_r = "n" ]; then
# 1661| __gitcomp_direct "$(__git_heads "" "$cur" " ")"
# 1662| else
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/doc/git/contrib/completion/git-completion.bash:1740:8: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 1738| __git_has_doubledash && return
# 1739|
# 1740|-> local dwim_opt="$(__git_checkout_default_dwim_mode)"
# 1741|
# 1742| case "$prev" in
Error: SHELLCHECK_WARNING (CWE-156):
/usr/share/doc/git/contrib/completion/git-completion.bash:2397:7: warning[SC2046]: Quote this to prevent word splitting.
# 2395| esac
# 2396|
# 2397|-> if [ $(__git_count_arguments "mv") -gt 0 ]; then
# 2398| # We need to show both cached and untracked files (including
# 2399| # empty directories) since this may not be the last argument.
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/doc/git/contrib/completion/git-completion.bash:2409:8: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 2407| {
# 2408| local subcommands='add append copy edit get-ref list merge prune remove show'
# 2409|-> local subcommand="$(__git_find_on_cmdline "$subcommands")"
# 2410|
# 2411| case "$subcommand,$cur" in
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/doc/git/contrib/completion/git-completion.bash:2692:8: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 2690| _git_switch ()
# 2691| {
# 2692|-> local dwim_opt="$(__git_checkout_default_dwim_mode)"
# 2693|
# 2694| case "$prev" in
Error: SHELLCHECK_WARNING (CWE-480):
/usr/share/doc/git/contrib/completion/git-completion.bash:2743:34: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 2741| __git_config_get_set_variables ()
# 2742| {
# 2743|-> local prevword word config_file= c=$cword
# 2744| while [ $c -gt "$__git_cmd_idx" ]; do
# 2745| word="${words[c]}"
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/doc/git/contrib/completion/git-completion.bash:3080:8: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 3078| get-url set-url show prune update
# 3079| "
# 3080|-> local subcommand="$(__git_find_on_cmdline "$subcommands")"
# 3081| if [ -z "$subcommand" ]; then
# 3082| case "$cur" in
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/doc/git/contrib/completion/git-completion.bash:3147:8: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 3145| {
# 3146| local subcommands="clear forget diff remaining status gc"
# 3147|-> local subcommand="$(__git_find_on_cmdline "$subcommands")"
# 3148| if test -z "$subcommand"
# 3149| then
Error: SHELLCHECK_WARNING (CWE-670):
/usr/share/doc/git/contrib/completion/git-completion.bash:3308:11: warning[SC2128]: Expanding an array without an index only gives the first element.
# 3306| # that's fine too.
# 3307| [[ "$cur" =~ .*/ ]]
# 3308|-> _tmp_dir=$BASH_REMATCH
# 3309|
# 3310| # Find possible directory completions, adding trailing '/' characters,
Error: SHELLCHECK_WARNING (CWE-140):
/usr/share/doc/git/contrib/completion/git-completion.bash:3404:14: warning[SC2206]: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.
# 3402| # We found some completions; return them
# 3403| local IFS=$'\n'
# 3404|-> COMPREPLY=($completions)
# 3405| else
# 3406| # Do NOT fall back to bash-style all-local-files-and-dirs
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/doc/git/contrib/completion/git-completion.bash:3438:8: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 3436| {
# 3437| local subcommands="list init set disable add reapply"
# 3438|-> local subcommand="$(__git_find_on_cmdline "$subcommands")"
# 3439| local using_cone=true
# 3440| if [ -z "$subcommand" ]; then
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/doc/git/contrib/completion/git-completion.bash:3469:8: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 3467| {
# 3468| local subcommands='push list show apply clear drop pop create branch'
# 3469|-> local subcommand="$(__git_find_on_cmdline "$subcommands save")"
# 3470|
# 3471| if [ -z "$subcommand" ]; then
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/doc/git/contrib/completion/git-completion.bash:3517:8: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 3515|
# 3516| local subcommands="add status init deinit update set-branch set-url summary foreach sync absorbgitdirs"
# 3517|-> local subcommand="$(__git_find_on_cmdline "$subcommands")"
# 3518| if [ -z "$subcommand" ]; then
# 3519| case "$cur" in
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/doc/git/contrib/completion/git-completion.bash:3569:8: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 3567| migrate mkdirs reset gc
# 3568| "
# 3569|-> local subcommand="$(__git_find_on_cmdline "$subcommands")"
# 3570| if [ -z "$subcommand" ]; then
# 3571| __gitcomp "$subcommands"
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/doc/git/contrib/completion/git-completion.bash:3940:8: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 3938| __git_complete_command "$command" && return
# 3939|
# 3940|-> local expansion=$(__git_aliased_command "$command")
# 3941| if [ -n "$expansion" ]; then
# 3942| words[1]=$expansion
Error: SHELLCHECK_WARNING (CWE-758):
/usr/share/doc/git/contrib/completion/git-prompt.sh:1:1: error[SC2148]: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
# 1|-> # bash/zsh git prompt support
# 2| #
# 3| # Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
Error: SHELLCHECK_WARNING (CWE-563):
/usr/share/doc/git/contrib/completion/git-prompt.sh:159:48: warning[SC2034]: n appears unused. Verify use (or export if used externally).
# 157| {
# 158| local key value
# 159|-> local svn_remotes="" svn_url_pattern="" count n
# 160| local upstream_type=git legacy="" verbose="" name=""
# 161| local LF="$__git_LF"
Error: SHELLCHECK_WARNING (CWE-457):
/usr/share/doc/git/contrib/completion/git-prompt.sh:161:12: warning[SC2154]: __git_LF is referenced but not assigned.
# 159| local svn_remotes="" svn_url_pattern="" count n
# 160| local upstream_type=git legacy="" verbose="" name=""
# 161|-> local LF="$__git_LF"
# 162|
# 163| # get some config options from git-config
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/doc/git/contrib/completion/git-prompt.sh:164:8: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 162|
# 163| # get some config options from git-config
# 164|-> local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
# 165| while read -r key value; do
# 166| case "$key" in
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/doc/git/contrib/completion/git-prompt.sh:207:9: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 205| # get upstream from "git-svn-id: UPSTRM@N HASH" in a commit message
# 206| # (git-svn uses essentially the same procedure internally)
# 207|-> local svn_upstream="$(
# 208| git log --first-parent -1 \
# 209| --grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null
Error: SHELLCHECK_WARNING (CWE-457):
/usr/share/doc/git/contrib/completion/git-prompt.sh:317:47: warning[SC2154]: __git_ESC is referenced but not assigned.
# 315| # which bash/readline identify while calculating the prompt
# 316| # on-screen width - to exclude 0-screen-width esc sequences.
# 317|-> local c_pre="${GIT_PS1_COLOR_PRE-$__git_SOH}${__git_ESC}["
# 318| local c_post="m${GIT_PS1_COLOR_POST-$__git_STX}"
# 319|
Error: SHELLCHECK_WARNING (CWE-457):
/usr/share/doc/git/contrib/completion/git-prompt.sh:359:22: warning[SC2154]: __git_CRLF is referenced but not assigned.
# 357| __git_eread ()
# 358| {
# 359|-> test -r "$1" && IFS=$__git_CRLF read -r "$2" <"$1"
# 360| }
# 361|
Error: SHELLCHECK_WARNING (CWE-569):
/usr/share/doc/git/contrib/completion/git-prompt.sh:575:6: warning[SC2221]: This pattern always overrides a later one on line 575.
# 573| (describe)
# 574| git describe HEAD ;;
# 575|-> (* | default)
# 576| git describe --tags --exact-match HEAD ;;
# 577| esac 2>/dev/null)" ||
Error: SHELLCHECK_WARNING (CWE-569):
/usr/share/doc/git/contrib/completion/git-prompt.sh:575:10: warning[SC2222]: This pattern never matches because of a previous pattern on line 575.
# 573| (describe)
# 574| git describe HEAD ;;
# 575|-> (* | default)
# 576| git describe --tags --exact-match HEAD ;;
# 577| esac 2>/dev/null)" ||
Error: SHELLCHECK_WARNING (CWE-569):
/usr/share/doc/git/contrib/coverage-diff.sh:48:1: warning[SC2188]: This redirection doesn't have a command. Move to its command (or use 'true' as no-op).
# 46|
# 47| # create empty file
# 48|-> >coverage-data.txt
# 49|
# 50| for file in $files
Error: SHELLCHECK_WARNING (CWE-477):
/usr/share/doc/git/contrib/fast-import/git-import.sh:7:14: warning[SC2166]: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
# 5| # but is meant to be a simple fast-import example.
# 6|
# 7|-> if [ -z "$1" -o -z "$2" ]; then
# 8| echo "usage: git-import branch import-message"
# 9| exit 1
Error: SHELLCHECK_WARNING (CWE-477):
/usr/share/doc/git/contrib/fast-import/git-import.sh:15:21: warning[SC2166]: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
# 13| EMAIL="$(git config user.email)"
# 14|
# 15|-> if [ -z "$USERNAME" -o -z "$EMAIL" ]; then
# 16| echo "You need to set user name and email"
# 17| exit 1
Error: SHELLCHECK_WARNING (CWE-156):
/usr/share/doc/git/contrib/fast-import/git-import.sh:33:13: warning[SC2046]: Quote this to prevent word splitting.
# 31| find * -type f|while read i;do
# 32| echo "M 100644 inline $i"
# 33|-> echo data $(stat -c '%s' "$i")
# 34| cat "$i"
# 35| echo
Error: SHELLCHECK_WARNING (CWE-563):
/usr/share/doc/git/contrib/rerere-train.sh:14:1: warning[SC2034]: SUBDIRECTORY_OK appears unused. Verify use (or export if used externally).
# 12| )
# 13|
# 14|-> SUBDIRECTORY_OK=Yes
# 15|
# 16| overwrite=0
Error: SHELLCHECK_WARNING (CWE-252):
/usr/share/doc/git/contrib/update-unicode/update_unicode.sh:8:1: warning[SC2164]: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
# 6| #Cf Format a format control character
# 7| #
# 8|-> cd "$(dirname "$0")"
# 9| UNICODEWIDTH_H=$(git rev-parse --show-toplevel)/unicode-width.h
# 10|
Error: SHELLCHECK_WARNING (CWE-758):
/usr/share/git-core/contrib/completion/git-prompt.sh:1:1: error[SC2148]: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
# 1|-> # bash/zsh git prompt support
# 2| #
# 3| # Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
Error: SHELLCHECK_WARNING (CWE-563):
/usr/share/git-core/contrib/completion/git-prompt.sh:159:48: warning[SC2034]: n appears unused. Verify use (or export if used externally).
# 157| {
# 158| local key value
# 159|-> local svn_remotes="" svn_url_pattern="" count n
# 160| local upstream_type=git legacy="" verbose="" name=""
# 161| local LF="$__git_LF"
Error: SHELLCHECK_WARNING (CWE-457):
/usr/share/git-core/contrib/completion/git-prompt.sh:161:12: warning[SC2154]: __git_LF is referenced but not assigned.
# 159| local svn_remotes="" svn_url_pattern="" count n
# 160| local upstream_type=git legacy="" verbose="" name=""
# 161|-> local LF="$__git_LF"
# 162|
# 163| # get some config options from git-config
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/git-core/contrib/completion/git-prompt.sh:164:8: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 162|
# 163| # get some config options from git-config
# 164|-> local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
# 165| while read -r key value; do
# 166| case "$key" in
Error: SHELLCHECK_WARNING (CWE-571):
/usr/share/git-core/contrib/completion/git-prompt.sh:207:9: warning[SC2155]: Declare and assign separately to avoid masking return values.
# 205| # get upstream from "git-svn-id: UPSTRM@N HASH" in a commit message
# 206| # (git-svn uses essentially the same procedure internally)
# 207|-> local svn_upstream="$(
# 208| git log --first-parent -1 \
# 209| --grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null
Error: SHELLCHECK_WARNING (CWE-457):
/usr/share/git-core/contrib/completion/git-prompt.sh:317:47: warning[SC2154]: __git_ESC is referenced but not assigned.
# 315| # which bash/readline identify while calculating the prompt
# 316| # on-screen width - to exclude 0-screen-width esc sequences.
# 317|-> local c_pre="${GIT_PS1_COLOR_PRE-$__git_SOH}${__git_ESC}["
# 318| local c_post="m${GIT_PS1_COLOR_POST-$__git_STX}"
# 319|
Error: SHELLCHECK_WARNING (CWE-457):
/usr/share/git-core/contrib/completion/git-prompt.sh:359:22: warning[SC2154]: __git_CRLF is referenced but not assigned.
# 357| __git_eread ()
# 358| {
# 359|-> test -r "$1" && IFS=$__git_CRLF read -r "$2" <"$1"
# 360| }
# 361|
Error: SHELLCHECK_WARNING (CWE-569):
/usr/share/git-core/contrib/completion/git-prompt.sh:575:6: warning[SC2221]: This pattern always overrides a later one on line 575.
# 573| (describe)
# 574| git describe HEAD ;;
# 575|-> (* | default)
# 576| git describe --tags --exact-match HEAD ;;
# 577| esac 2>/dev/null)" ||
Error: SHELLCHECK_WARNING (CWE-569):
/usr/share/git-core/contrib/completion/git-prompt.sh:575:10: warning[SC2222]: This pattern never matches because of a previous pattern on line 575.
# 573| (describe)
# 574| git describe HEAD ;;
# 575|-> (* | default)
# 576| git describe --tags --exact-match HEAD ;;
# 577| esac 2>/dev/null)" ||
Error: SHELLCHECK_WARNING (CWE-156):
/usr/share/git-core/templates/hooks/pre-commit.sample:31:7: warning[SC2046]: Quote this to prevent word splitting.
# 29| # even required, for portability to Solaris 10's /usr/bin/tr), since
# 30| # the square bracket bytes happen to fall in the designated range.
# 31|-> test $(git diff-index --cached --name-only --diff-filter=A -z $against |
# 32| LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
# 33| then
Error: SHELLCHECK_WARNING (CWE-563):
/usr/share/git-core/templates/hooks/pre-push.sample:22:1: warning[SC2034]: remote appears unused. Verify use (or export if used externally).
# 20| # with "WIP" (work in progress).
# 21|
# 22|-> remote="$1"
# 23| url="$2"
# 24|
Error: SHELLCHECK_WARNING (CWE-563):
/usr/share/git-core/templates/hooks/pre-push.sample:23:1: warning[SC2034]: url appears unused. Verify use (or export if used externally).
# 21|
# 22| remote="$1"
# 23|-> url="$2"
# 24|
# 25| zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
Error: SHELLCHECK_WARNING (CWE-563):
/usr/share/git-core/templates/hooks/pre-push.sample:27:32: warning[SC2034]: remote_ref appears unused. Verify use (or export if used externally).
# 25| zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
# 26|
# 27|-> while read local_ref local_oid remote_ref remote_oid
# 28| do
# 29| if test "$local_oid" = "$zero"
Error: SHELLCHECK_WARNING (CWE-563):
/usr/share/git-core/templates/hooks/pre-rebase.sample:19:1: warning[SC2034]: basebranch appears unused. Verify use (or export if used externally).
# 17|
# 18| publish=next
# 19|-> basebranch="$1"
# 20| if test "$#" = 2
# 21| then
Error: SHELLCHECK_WARNING (CWE-569):
/usr/share/git-core/templates/hooks/pre-rebase.sample:91:1: warning[SC2188]: This redirection doesn't have a command. Move to its command (or use 'true' as no-op).
# 89| fi
# 90|
# 91|-> <<\DOC_END
# 92|
# 93| This sample hook safeguards topic branches that have been
Error: SHELLCHECK_WARNING (CWE-457):
/usr/share/git-core/templates/hooks/pre-receive.sample:15:9: warning[SC2154]: value is referenced but not assigned.
# 13| do
# 14| eval "value=\$GIT_PUSH_OPTION_$i"
# 15|-> case "$value" in
# 16| echoback=*)
# 17| echo "echo from the pre-receive-hook: ${value#*=}" >&2
Error: SHELLCHECK_WARNING (CWE-563):
/usr/share/git-core/templates/hooks/prepare-commit-msg.sample:24:1: warning[SC2034]: COMMIT_SOURCE appears unused. Verify use (or export if used externally).
# 22|
# 23| COMMIT_MSG_FILE=$1
# 24|-> COMMIT_SOURCE=$2
# 25| SHA1=$3
# 26|
Error: SHELLCHECK_WARNING (CWE-563):
/usr/share/git-core/templates/hooks/prepare-commit-msg.sample:25:1: warning[SC2034]: SHA1 appears unused. Verify use (or export if used externally).
# 23| COMMIT_MSG_FILE=$1
# 24| COMMIT_SOURCE=$2
# 25|-> SHA1=$3
# 26|
# 27| /usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
Error: SHELLCHECK_WARNING (CWE-477):
/usr/share/git-core/templates/hooks/update.sample:40:20: warning[SC2166]: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
# 38| fi
# 39|
# 40|-> if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
# 41| echo "usage: $0 <ref> <oldrev> <newrev>" >&2
# 42| exit 1
Error: SHELLCHECK_WARNING (CWE-477):
/usr/share/git-core/templates/hooks/update.sample:40:36: warning[SC2166]: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
# 38| fi
# 39|
# 40|-> if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
# 41| echo "usage: $0 <ref> <oldrev> <newrev>" >&2
# 42| exit 1
Error: SHELLCHECK_WARNING (CWE-477):
/usr/share/git-core/templates/hooks/update.sample:98:28: warning[SC2166]: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
# 96| refs/heads/*,commit)
# 97| # branch
# 98|-> if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
# 99| echo "*** Creating a branch is not allowed in this repository" >&2
# 100| exit 1
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/add-patch.c: scope_hint: In function ‘parse_hunk_header’
git-2.53.0/add-patch.c:345:21: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 345 | char *eol = memchr(p, '\n', s->plain.len - hunk->start);
# | ^~~~~~
# 343| struct hunk_header *header = &hunk->header;
# 344| const char *line = s->plain.buf + hunk->start, *p = line;
# 345|-> char *eol = memchr(p, '\n', s->plain.len - hunk->start);
# 346|
# 347| if (!eol)
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/add-patch.c:345:21: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 343| struct hunk_header *header = &hunk->header;
# 344| const char *line = s->plain.buf + hunk->start, *p = line;
# 345|-> char *eol = memchr(p, '\n', s->plain.len - hunk->start);
# 346|
# 347| if (!eol)
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/add-patch.c:369:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 369 | eol = memchr(line, '\n', s->colored.len - hunk->colored_start);
# | ^
# 367| /* Now find the extra text in the colored diff */
# 368| line = s->colored.buf + hunk->colored_start;
# 369|-> eol = memchr(line, '\n', s->colored.len - hunk->colored_start);
# 370| if (!eol)
# 371| eol = s->colored.buf + s->colored.len;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/add-patch.c:369:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 367| /* Now find the extra text in the colored diff */
# 368| line = s->colored.buf + hunk->colored_start;
# 369|-> eol = memchr(line, '\n', s->colored.len - hunk->colored_start);
# 370| if (!eol)
# 371| eol = s->colored.buf + s->colored.len;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/apply.c: scope_hint: In function ‘preimage_oid_in_gitlink_patch’
git-2.53.0/apply.c:4154:23: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 4154 | (preimage = memchr(hunk->patch, '\n', hunk->size)) != NULL &&
# | ^
# 4152| hunk->oldpos == 1 && hunk->oldlines == 1 &&
# 4153| /* does preimage begin with the heading? */
# 4154|-> (preimage = memchr(hunk->patch, '\n', hunk->size)) != NULL &&
# 4155| starts_with(++preimage, heading) &&
# 4156| /* does it record full SHA-1? */
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/apply.c:4154:23: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 4152| hunk->oldpos == 1 && hunk->oldlines == 1 &&
# 4153| /* does preimage begin with the heading? */
# 4154|-> (preimage = memchr(hunk->patch, '\n', hunk->size)) != NULL &&
# 4155| starts_with(++preimage, heading) &&
# 4156| /* does it record full SHA-1? */
Error: GCC_ANALYZER_WARNING:
git-2.53.0/archive-tar.c:509:13: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘1’
git-2.53.0/archive-tar.c:479:12: branch_false: following ‘false’ branch...
git-2.53.0/archive-tar.c:482:14: branch_false: ...to here
git-2.53.0/archive-tar.c:482:12: branch_false: following ‘false’ branch (when the strings are non-equal)...
git-2.53.0/archive-tar.c:497:9: branch_false: ...to here
git-2.53.0/archive-tar.c:506:12: branch_false: following ‘false’ branch...
git-2.53.0/archive-tar.c:508:9: branch_false: ...to here
git-2.53.0/archive-tar.c:508:9: release_resource: closed here
git-2.53.0/archive-tar.c:509:13: danger: ‘1’ could be invalid
# 507| die_errno(_("unable to start '%s' filter"), cmd.buf);
# 508| close(1);
# 509|-> if (dup2(filter.in, 1) < 0)
# 510| die_errno(_("unable to redirect descriptor"));
# 511| close(filter.in);
Error: GCC_ANALYZER_WARNING (CWE-1341):
git-2.53.0/archive-tar.c:515:9: warning[-Wanalyzer-fd-double-close]: double ‘close’ of file descriptor ‘1’
git-2.53.0/archive-tar.c:471:12: enter_function: entry to ‘write_tar_filter_archive’
git-2.53.0/archive-tar.c:479:12: branch_false: following ‘false’ branch...
git-2.53.0/archive-tar.c:482:14: branch_false: ...to here
git-2.53.0/archive-tar.c:482:12: branch_false: following ‘false’ branch (when the strings are non-equal)...
git-2.53.0/archive-tar.c:497:9: branch_false: ...to here
git-2.53.0/archive-tar.c:506:12: branch_false: following ‘false’ branch...
git-2.53.0/archive-tar.c:508:9: branch_false: ...to here
git-2.53.0/archive-tar.c:508:9: release_resource: first ‘close’ here
git-2.53.0/archive-tar.c:509:12: branch_false: following ‘false’ branch...
git-2.53.0/archive-tar.c:511:9: branch_false: ...to here
git-2.53.0/archive-tar.c:513:13: call_function: calling ‘write_tar_archive’ from ‘write_tar_filter_archive’
git-2.53.0/archive-tar.c:513:13: return_function: returning to ‘write_tar_filter_archive’ from ‘write_tar_archive’
git-2.53.0/archive-tar.c:515:9: danger: second ‘close’ here; first ‘close’ was at [(8)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/7)
# 513| r = write_tar_archive(ar, args);
# 514|
# 515|-> close(1);
# 516| if (finish_command(&filter) != 0)
# 517| die(_("'%s' filter reported error"), cmd.buf);
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/blame.c:2843:24: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘c’
git-2.53.0/blame.c:2765:6: enter_function: entry to ‘setup_scoreboard’
git-2.53.0/blame.c:2778:12: branch_false: following ‘false’ branch...
git-2.53.0/blame.c:2781:12: branch_false: ...to here
git-2.53.0/blame.c:2782:29: call_function: calling ‘find_single_final’ from ‘setup_scoreboard’
git-2.53.0/blame.c:2782:29: return_function: returning to ‘setup_scoreboard’ from ‘find_single_final’
git-2.53.0/blame.c:2789:12: branch_true: following ‘true’ branch...
git-2.53.0/blame.c:2792:12: branch_false: following ‘false’ branch...
git-2.53.0/blame.c:2836:12: branch_false: following ‘false’ branch...
git-2.53.0/blame.c:2839:13: branch_false: ...to here
git-2.53.0/blame.c:2839:12: branch_true: following ‘true’ branch...
git-2.53.0/blame.c:2843:24: danger: dereference of NULL ‘c’
# 2841|
# 2842| sb->revs->children.name = "children";
# 2843|-> while (c->parents &&
# 2844| !oideq(&c->object.oid, &sb->final->object.oid)) {
# 2845| struct commit_list *l = xcalloc(1, sizeof(*l));
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/bloom.c: scope_hint: In function ‘get_or_compute_bloom_filter’
git-2.53.0/bloom.c:515:52: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 515 | char *last_slash = strrchr(path, '/');
# | ^~~~~~~
# 513| */
# 514| do {
# 515|-> char *last_slash = strrchr(path, '/');
# 516|
# 517| FLEX_ALLOC_STR(e, path, path);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/bloom.c:515:52: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 513| */
# 514| do {
# 515|-> char *last_slash = strrchr(path, '/');
# 516|
# 517| FLEX_ALLOC_STR(e, path, path);
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/branch.c:168:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
git-2.53.0/branch.c:652:6: enter_function: entry to ‘dwim_and_setup_tracking’
git-2.53.0/branch.c:657:9: call_function: calling ‘dwim_branch_start’ from ‘dwim_and_setup_tracking’
git-2.53.0/branch.c:657:9: return_function: returning to ‘dwim_and_setup_tracking’ from ‘dwim_branch_start’
git-2.53.0/branch.c:658:9: call_function: calling ‘setup_tracking’ from ‘dwim_and_setup_tracking’
# 166| * upstream branch.
# 167| */
# 168|-> printf_ln(rebasing ?
# 169| _("branch '%s' set up to track '%s' by rebasing.") :
# 170| _("branch '%s' set up to track '%s'."),
Error: GCC_ANALYZER_WARNING (CWE-775):
git-2.53.0/builtin/archive.c:16:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(xopen(output_file, 577, 438), 1)’
git-2.53.0/builtin/archive.c:15:12: branch_true: following ‘true’ branch...
git-2.53.0/builtin/archive.c:16:21: branch_true: ...to here
git-2.53.0/builtin/archive.c:16:21: acquire_resource: opened here
git-2.53.0/builtin/archive.c:16:20: danger: ‘dup2(xopen(output_file, 577, 438), 1)’ leaks here; was opened at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
# 14| int output_fd = xopen(output_file, O_CREAT | O_WRONLY | O_TRUNC, 0666);
# 15| if (output_fd != 1) {
# 16|-> if (dup2(output_fd, 1) < 0)
# 17| die_errno(_("could not redirect output"));
# 18| else
Error: GCC_ANALYZER_WARNING (CWE-457):
git-2.53.0/builtin/cat-file.c:152:36: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘type’
git-2.53.0/builtin/cat-file.c:1020:5: enter_function: entry to ‘cmd_cat_file’
git-2.53.0/builtin/cat-file.c:1168:12: branch_false: following ‘false’ branch...
git-2.53.0/builtin/cat-file.c:1182:13: branch_false: ...to here
git-2.53.0/builtin/cat-file.c:1182:12: branch_true: following ‘true’ branch...
git-2.53.0/builtin/cat-file.c:1183:20: branch_true: ...to here
git-2.53.0/builtin/cat-file.c:1191:25: branch_false: following ‘false’ branch...
git-2.53.0/builtin/cat-file.c:1194:25: branch_false: ...to here
git-2.53.0/builtin/cat-file.c:1194:25: branch_true: following ‘true’ branch...
git-2.53.0/builtin/cat-file.c:1195:25: branch_true: ...to here
git-2.53.0/builtin/cat-file.c:1209:15: call_function: calling ‘cat_one_file’ from ‘cmd_cat_file’
# 150| die("git cat-file: could not get object info");
# 151|
# 152|-> if (use_mailmap && (type == OBJ_COMMIT || type == OBJ_TAG)) {
# 153| size_t s = size;
# 154| buf = replace_idents_using_mailmap(buf, &s);
Error: GCC_ANALYZER_WARNING (CWE-688):
git-2.53.0/builtin/clone.c:1107:26: warning[-Wanalyzer-null-argument]: use of NULL ‘work_tree’ where non-null expected
git-2.53.0/builtin/clone.c:864:5: enter_function: entry to ‘cmd_clone’
git-2.53.0/builtin/clone.c:898:21: release_memory: ‘real_git_dir’ is NULL
git-2.53.0/builtin/clone.c:899:21: release_memory: ‘real_git_dir’ is NULL
git-2.53.0/builtin/clone.c:908:21: release_memory: ‘real_git_dir’ is NULL
git-2.53.0/builtin/clone.c:997:28: release_memory: ‘real_git_dir’ is NULL
git-2.53.0/builtin/clone.c:1009:12: branch_false: following ‘false’ branch...
git-2.53.0/builtin/clone.c:1013:12: branch_false: ...to here
git-2.53.0/builtin/clone.c:1013:12: branch_false: following ‘false’ branch...
git-2.53.0/builtin/clone.c:1017:13: branch_false: ...to here
git-2.53.0/builtin/clone.c:1046:16: call_function: calling ‘get_repo_path’ from ‘cmd_clone’
git-2.53.0/builtin/clone.c:1046:16: return_function: returning to ‘cmd_clone’ from ‘get_repo_path’
git-2.53.0/builtin/clone.c:1047:12: branch_false: following ‘false’ branch...
git-2.53.0/builtin/clone.c:1050:20: branch_false: ...to here
git-2.53.0/builtin/clone.c:1050:19: branch_true: following ‘true’ branch...
git-2.53.0/builtin/clone.c:1052:32: branch_true: ...to here
git-2.53.0/builtin/clone.c:1091:12: branch_true: following ‘true’ branch...
git-2.53.0/builtin/clone.c:1092:27: branch_true: ...to here
git-2.53.0/builtin/clone.c:1101:12: branch_true: following ‘true’ branch...
git-2.53.0/builtin/clone.c:1102:21: branch_true: ...to here
git-2.53.0/builtin/clone.c:1102:20: branch_false: following ‘false’ branch...
git-2.53.0/builtin/clone.c:1105:20: branch_false: ...to here
git-2.53.0/builtin/clone.c:1105:20: branch_false: following ‘false’ branch...
git-2.53.0/builtin/clone.c:1107:26: branch_false: ...to here
git-2.53.0/builtin/clone.c:1107:26: danger: argument 1 (‘work_tree’) NULL where non-null expected
# 1105| if (dest_exists)
# 1106| junk_work_tree_flags |= REMOVE_DIR_KEEP_TOPLEVEL;
# 1107|-> else if (mkdir(work_tree, 0777))
# 1108| die_errno(_("could not create work tree dir '%s'"),
# 1109| work_tree);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/commit.c: scope_hint: In function ‘prepare_to_commit’
git-2.53.0/builtin/commit.c:820:24: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 820 | buffer = strstr(use_message_buffer, "\n\n");
# | ^
# 818| } else if (use_message) {
# 819| char *buffer;
# 820|-> buffer = strstr(use_message_buffer, "\n\n");
# 821| if (buffer)
# 822| strbuf_addstr(&sb, skip_blank_lines(buffer + 2));
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/commit.c:820:24: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 818| } else if (use_message) {
# 819| char *buffer;
# 820|-> buffer = strstr(use_message_buffer, "\n\n");
# 821| if (buffer)
# 822| strbuf_addstr(&sb, skip_blank_lines(buffer + 2));
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/config.c: scope_hint: In function ‘get_urlmatch’
git-2.53.0/builtin/config.c:723:22: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 723 | section_tail = strchr(config.section, '.');
# | ^
# 721|
# 722| config.section = xstrdup_tolower(var);
# 723|-> section_tail = strchr(config.section, '.');
# 724| if (section_tail) {
# 725| *section_tail = '\0';
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/config.c:723:22: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 721|
# 722| config.section = xstrdup_tolower(var);
# 723|-> section_tail = strchr(config.section, '.');
# 724| if (section_tail) {
# 725| *section_tail = '\0';
Error: GCC_ANALYZER_WARNING (CWE-688):
git-2.53.0/builtin/gc.c:2887:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘cron_list’ where non-null expected
git-2.53.0/builtin/gc.c:2844:12: enter_function: entry to ‘crontab_update_schedule’
git-2.53.0/builtin/gc.c:2854:22: call_function: calling ‘get_random_minute’ from ‘crontab_update_schedule’
git-2.53.0/builtin/gc.c:2854:22: return_function: returning to ‘crontab_update_schedule’ from ‘get_random_minute’
git-2.53.0/builtin/gc.c:2856:9: call_function: calling ‘get_schedule_cmd’ from ‘crontab_update_schedule’
git-2.53.0/builtin/gc.c:2856:9: return_function: returning to ‘crontab_update_schedule’ from ‘get_schedule_cmd’
git-2.53.0/builtin/gc.c:2863:12: branch_false: following ‘false’ branch...
git-2.53.0/builtin/gc.c:2869:9: branch_false: ...to here
git-2.53.0/builtin/gc.c:2872:12: branch_false: following ‘false’ branch...
git-2.53.0/builtin/gc.c:2876:19: branch_false: ...to here
git-2.53.0/builtin/gc.c:2877:12: branch_false: following ‘false’ branch...
git-2.53.0/builtin/gc.c:2886:21: branch_false: ...to here
git-2.53.0/builtin/gc.c:2886:21: acquire_memory: this call could return NULL
git-2.53.0/builtin/gc.c:2887:9: danger: argument 1 (‘cron_list’) from [(20)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/19) could be NULL where non-null expected
# 2885| */
# 2886| cron_list = fdopen(fd, "r");
# 2887|-> rewind(cron_list);
# 2888|
# 2889| while (!strbuf_getline_lf(&line, cron_list)) {
Error: GCC_ANALYZER_WARNING (CWE-688):
git-2.53.0/builtin/interpret-trailers.c:105:13: warning[-Wanalyzer-null-argument]: use of NULL ‘file’ where non-null expected
git-2.53.0/builtin/interpret-trailers.c:194:5: enter_function: entry to ‘cmd_interpret_trailers’
git-2.53.0/builtin/interpret-trailers.c:235:12: branch_false: following ‘false’ branch...
git-2.53.0/builtin/interpret-trailers.c:240:21: branch_false: ...to here
git-2.53.0/builtin/interpret-trailers.c:240:20: branch_false: following ‘false’ branch...
git-2.53.0/builtin/interpret-trailers.c:242:17: branch_false: ...to here
git-2.53.0/builtin/interpret-trailers.c:242:17: call_function: calling ‘interpret_trailers’ from ‘cmd_interpret_trailers’
# 103| FILE *outfile;
# 104|
# 105|-> if (stat(file, &st))
# 106| die_errno(_("could not stat %s"), file);
# 107| if (!S_ISREG(st.st_mode))
Error: GCC_ANALYZER_WARNING (CWE-688):
git-2.53.0/builtin/ls-files.c:339:25: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
git-2.53.0/builtin/ls-files.c:576:5: enter_function: entry to ‘cmd_ls_files’
git-2.53.0/builtin/ls-files.c:667:12: branch_false: following ‘false’ branch...
git-2.53.0/builtin/ls-files.c:670:16: branch_false: ...to here
git-2.53.0/builtin/ls-files.c:730:12: branch_true: following ‘true’ branch...
git-2.53.0/builtin/ls-files.c:734:26: branch_true: ...to here
git-2.53.0/builtin/ls-files.c:734:26: call_function: calling ‘get_common_prefix_len’ from ‘cmd_ls_files’
git-2.53.0/builtin/ls-files.c:734:26: return_function: returning to ‘cmd_ls_files’ from ‘get_common_prefix_len’
git-2.53.0/builtin/ls-files.c:736:9: call_function: calling ‘prune_index’ from ‘cmd_ls_files’
git-2.53.0/builtin/ls-files.c:736:9: return_function: returning to ‘cmd_ls_files’ from ‘prune_index’
git-2.53.0/builtin/ls-files.c:763:9: call_function: calling ‘show_files’ from ‘cmd_ls_files’
# 337|
# 338| if (!show_stage) {
# 339|-> fputs(tag, stdout);
# 340| } else {
# 341| printf("%s%06o %s %d\t",
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/builtin/name-rev.c:225:46: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
git-2.53.0/builtin/name-rev.c:557:5: enter_function: entry to ‘cmd_name_rev’
git-2.53.0/builtin/name-rev.c:609:12: branch_false: following ‘false’ branch...
git-2.53.0/builtin/name-rev.c:613:12: branch_false: ...to here
git-2.53.0/builtin/name-rev.c:659:9: call_function: calling ‘name_tips’ from ‘cmd_name_rev’
# 223| distance = name->distance + MERGE_TRAVERSAL_WEIGHT;
# 224| } else {
# 225|-> generation = name->generation + 1;
# 226| distance = name->distance + 1;
# 227| }
Error: GCC_ANALYZER_WARNING (CWE-688):
git-2.53.0/builtin/pull.c:630:22: warning[-Wanalyzer-null-argument]: use of NULL ‘remote’ where non-null expected
git-2.53.0/builtin/pull.c:856:5: enter_function: entry to ‘cmd_pull’
git-2.53.0/builtin/pull.c:1034:9: call_function: inlined call to ‘parse_repo_refspecs’ from ‘cmd_pull’
git-2.53.0/builtin/pull.c:1036:13: branch_false: ...to here
git-2.53.0/builtin/pull.c:1058:12: branch_false: following ‘false’ branch...
git-2.53.0/builtin/pull.c:1061:13: branch_false: ...to here
git-2.53.0/builtin/pull.c:1061:12: branch_false: following ‘false’ branch...
git-2.53.0/builtin/pull.c:1064:13: branch_false: ...to here
git-2.53.0/builtin/pull.c:1067:12: branch_true: following ‘true’ branch...
git-2.53.0/builtin/pull.c:1068:21: branch_true: ...to here
git-2.53.0/builtin/pull.c:1079:21: call_function: calling ‘get_rebase_fork_point’ from ‘cmd_pull’
# 628|
# 629| if (*spec_src) {
# 630|-> if (!strcmp(remote, "."))
# 631| merge_branch = mkpath("refs/heads/%s", spec_src);
# 632| else
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/receive-pack.c: scope_hint: In function ‘proc_receive_ref_append’
git-2.53.0/builtin/receive-pack.c:400:11: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 400 | p = strchr(prefix, ':');
# | ^
# 398|
# 399| CALLOC_ARRAY(ref_pattern, 1);
# 400|-> p = strchr(prefix, ':');
# 401| if (p) {
# 402| while (prefix < p) {
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/receive-pack.c:400:11: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 398|
# 399| CALLOC_ARRAY(ref_pattern, 1);
# 400|-> p = strchr(prefix, ':');
# 401| if (p) {
# 402| while (prefix < p) {
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/receive-pack.c: scope_hint: In function ‘read_proc_receive_report’
git-2.53.0/builtin/receive-pack.c:1009:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1009 | p = strchr(head, ' ');
# | ^
# 1007|
# 1008| head = reader->line;
# 1009|-> p = strchr(head, ' ');
# 1010| if (!p) {
# 1011| strbuf_addf(errmsg, "proc-receive reported incomplete status line: '%s'\n", head);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/receive-pack.c:1009:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1007|
# 1008| head = reader->line;
# 1009|-> p = strchr(head, ' ');
# 1010| if (!p) {
# 1011| strbuf_addf(errmsg, "proc-receive reported incomplete status line: '%s'\n", head);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/receive-pack.c:1039:27: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1039 | p = strchr(key, ' ');
# | ^
# 1037| }
# 1038| key = p;
# 1039|-> p = strchr(key, ' ');
# 1040| if (p)
# 1041| *p++ = '\0';
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/receive-pack.c:1039:27: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1037| }
# 1038| key = p;
# 1039|-> p = strchr(key, ' ');
# 1040| if (p)
# 1041| *p++ = '\0';
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/receive-pack.c:1062:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1062 | p = strchr(refname, ' ');
# | ^
# 1060| new_report = 0;
# 1061| refname = p;
# 1062|-> p = strchr(refname, ' ');
# 1063| if (p)
# 1064| *p++ = '\0';
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/receive-pack.c:1062:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1060| new_report = 0;
# 1061| refname = p;
# 1062|-> p = strchr(refname, ' ');
# 1063| if (p)
# 1064| *p++ = '\0';
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/remote.c: scope_hint: In function ‘config_read_branches’
git-2.53.0/builtin/remote.c:335:31: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 335 | char *space = strchr(value, ' ');
# | ^~~~~~
# 333| break;
# 334| case MERGE: {
# 335|-> char *space = strchr(value, ' ');
# 336| value = abbrev_branch(value);
# 337| while (space) {
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/remote.c:335:31: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 333| break;
# 334| case MERGE: {
# 335|-> char *space = strchr(value, ' ');
# 336| value = abbrev_branch(value);
# 337| while (space) {
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/remote.c:342:31: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 342 | space = strchr(value, ' ');
# | ^
# 340| string_list_append(&info->merge, merge);
# 341| value = abbrev_branch(space + 1);
# 342|-> space = strchr(value, ' ');
# 343| }
# 344| string_list_append(&info->merge, xstrdup(value));
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/remote.c:342:31: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 340| string_list_append(&info->merge, merge);
# 341| value = abbrev_branch(space + 1);
# 342|-> space = strchr(value, ' ');
# 343| }
# 344| string_list_append(&info->merge, xstrdup(value));
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/rev-parse.c: scope_hint: In function ‘try_difference’
git-2.53.0/builtin/rev-parse.c:278:22: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 278 | if (!(dotdot = strstr(arg, "..")))
# | ^
# 276| static const char head_by_default[] = "HEAD";
# 277|
# 278|-> if (!(dotdot = strstr(arg, "..")))
# 279| return 0;
# 280| end = dotdot + 2;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/rev-parse.c:278:22: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 276| static const char head_by_default[] = "HEAD";
# 277|
# 278|-> if (!(dotdot = strstr(arg, "..")))
# 279| return 0;
# 280| end = dotdot + 2;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/rev-parse.c: scope_hint: In function ‘try_parent_shorthands’
git-2.53.0/builtin/rev-parse.c:339:21: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 339 | if ((dotdot = strstr(arg, "^!"))) {
# | ^
# 337| int exclude_parent = 0;
# 338|
# 339|-> if ((dotdot = strstr(arg, "^!"))) {
# 340| include_rev = 1;
# 341| if (dotdot[2])
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/rev-parse.c:339:21: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 337| int exclude_parent = 0;
# 338|
# 339|-> if ((dotdot = strstr(arg, "^!"))) {
# 340| include_rev = 1;
# 341| if (dotdot[2])
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/rev-parse.c:343:28: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 343 | } else if ((dotdot = strstr(arg, "^@"))) {
# | ^
# 341| if (dotdot[2])
# 342| return 0;
# 343|-> } else if ((dotdot = strstr(arg, "^@"))) {
# 344| include_parents = 1;
# 345| if (dotdot[2])
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/rev-parse.c:343:28: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 341| if (dotdot[2])
# 342| return 0;
# 343|-> } else if ((dotdot = strstr(arg, "^@"))) {
# 344| include_parents = 1;
# 345| if (dotdot[2])
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/rev-parse.c:347:28: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 347 | } else if ((dotdot = strstr(arg, "^-"))) {
# | ^
# 345| if (dotdot[2])
# 346| return 0;
# 347|-> } else if ((dotdot = strstr(arg, "^-"))) {
# 348| include_rev = 1;
# 349| exclude_parent = 1;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/rev-parse.c:347:28: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 345| if (dotdot[2])
# 346| return 0;
# 347|-> } else if ((dotdot = strstr(arg, "^-"))) {
# 348| include_rev = 1;
# 349| exclude_parent = 1;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/shortlog.c: scope_hint: In function ‘insert_one_record’
git-2.53.0/builtin/shortlog.c:79:37: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 79 | char *eob = strchr(oneline, ']');
# | ^~~~~~
# 77| eol = oneline + strlen(oneline);
# 78| if (starts_with(oneline, "[PATCH")) {
# 79|-> char *eob = strchr(oneline, ']');
# 80| if (eob && (!eol || eob < eol))
# 81| oneline = eob + 1;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/builtin/shortlog.c:79:37: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 77| eol = oneline + strlen(oneline);
# 78| if (starts_with(oneline, "[PATCH")) {
# 79|-> char *eob = strchr(oneline, ']');
# 80| if (eob && (!eol || eob < eol))
# 81| oneline = eob + 1;
Error: GCC_ANALYZER_WARNING (CWE-617):
git-2.53.0/builtin/show-index.c:59:25: warning[-Wanalyzer-tainted-assertion]: use of attacked-controlled value in condition for assertion
git-2.53.0/builtin/show-index.c:54:12: branch_false: following ‘false’ branch...
git-2.53.0/builtin/show-index.c:56:13: branch_false: ...to here
git-2.53.0/builtin/show-index.c:56:12: branch_true: following ‘true’ branch...
git-2.53.0/builtin/show-index.c:57:27: branch_true: ...to here
git-2.53.0/builtin/show-index.c:58:20: branch_true: following ‘true’ branch...
git-2.53.0/builtin/show-index.c:59:25: branch_true: ...to here
git-2.53.0/builtin/show-index.c:59:25: danger: treating ‘die’ as an assertion failure handler due to ‘__attribute__((__noreturn__))’
# 57| version = ntohl(top_index[1]);
# 58| if (version < 2 || version > 2)
# 59|-> die("unknown index version");
# 60| if (fread(top_index, 256 * 4, 1, stdin) != 1)
# 61| die("unable to read index");
Error: GCC_ANALYZER_WARNING (CWE-688):
git-2.53.0/builtin/sparse-checkout.c:1152:17: warning[-Wanalyzer-null-argument]: use of NULL ‘xfopen(check_rules_opts.rules_file, "r")’ where non-null expected
git-2.53.0/builtin/sparse-checkout.c:1121:12: enter_function: entry to ‘sparse_checkout_check_rules’
git-2.53.0/builtin/sparse-checkout.c:1149:12: branch_true: following ‘true’ branch...
git-2.53.0/builtin/sparse-checkout.c:1150:22: branch_true: ...to here
git-2.53.0/builtin/sparse-checkout.c:1151:17: call_function: calling ‘add_patterns_from_input’ from ‘sparse_checkout_check_rules’
git-2.53.0/builtin/sparse-checkout.c:1151:17: return_function: returning to ‘sparse_checkout_check_rules’ from ‘add_patterns_from_input’
git-2.53.0/builtin/sparse-checkout.c:1152:17: danger: argument 1 (‘xfopen(check_rules_opts.rules_file, "r")’) NULL where non-null expected
# 1150| fp = xfopen(check_rules_opts.rules_file, "r");
# 1151| add_patterns_from_input(&pl, argc, argv, fp);
# 1152|-> fclose(fp);
# 1153| } else {
# 1154| sparse_filename = get_sparse_checkout_filename();
Error: GCC_ANALYZER_WARNING:
git-2.53.0/column.c:395:9: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘1’
git-2.53.0/column.c:370:12: branch_false: following ‘false’ branch...
git-2.53.0/column.c:373:9: branch_false: ...to here
git-2.53.0/column.c:390:12: branch_false: following ‘false’ branch...
git-2.53.0/column.c:393:18: branch_false: ...to here
git-2.53.0/column.c:394:9: release_resource: closed here
git-2.53.0/column.c:395:9: danger: ‘1’ could be invalid
# 393| fd_out = dup(1);
# 394| close(1);
# 395|-> dup2(column_process.in, 1);
# 396| close(column_process.in);
# 397| return 0;
Error: GCC_ANALYZER_WARNING:
git-2.53.0/column.c:408:9: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘1’
git-2.53.0/column.c:402:12: branch_false: following ‘false’ branch...
git-2.53.0/column.c:405:9: branch_false: ...to here
git-2.53.0/column.c:406:9: release_resource: closed here
git-2.53.0/column.c:408:9: danger: ‘1’ could be invalid
# 406| close(1);
# 407| finish_command(&column_process);
# 408|-> dup2(fd_out, 1);
# 409| close(fd_out);
# 410| fd_out = -1;
Error: GCC_ANALYZER_WARNING (CWE-775):
git-2.53.0/combine-diff.c:1073:46: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(*elem.path, 0)’
git-2.53.0/combine-diff.c:1282:6: enter_function: entry to ‘show_combined_diff’
git-2.53.0/combine-diff.c:1288:12: branch_false: following ‘false’ branch...
git-2.53.0/combine-diff.c:1292:18: branch_false: ...to here
git-2.53.0/combine-diff.c:1292:17: branch_true: following ‘true’ branch...
git-2.53.0/combine-diff.c:1293:17: branch_true: ...to here
git-2.53.0/combine-diff.c:1293:17: call_function: calling ‘show_patch_diff’ from ‘show_combined_diff’
# 1071| free_filespec(df);
# 1072| } else if (0 <= (fd = open(elem->path, O_RDONLY))) {
# 1073|-> size_t len = xsize_t(st.st_size);
# 1074| ssize_t done;
# 1075| int is_file, i;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/convert.c: scope_hint: In function ‘ident_to_git’
git-2.53.0/convert.c:1138:24: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1138 | dollar = memchr(src, '$', len);
# | ^
# 1136| dst = buf->buf;
# 1137| for (;;) {
# 1138|-> dollar = memchr(src, '$', len);
# 1139| if (!dollar)
# 1140| break;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/convert.c:1138:24: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1136| dst = buf->buf;
# 1137| for (;;) {
# 1138|-> dollar = memchr(src, '$', len);
# 1139| if (!dollar)
# 1140| break;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/convert.c:1147:32: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1147 | dollar = memchr(src + 3, '$', len - 3);
# | ^
# 1145|
# 1146| if (len > 3 && !memcmp(src, "Id:", 3)) {
# 1147|-> dollar = memchr(src + 3, '$', len - 3);
# 1148| if (!dollar)
# 1149| break;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/convert.c:1147:32: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1145|
# 1146| if (len > 3 && !memcmp(src, "Id:", 3)) {
# 1147|-> dollar = memchr(src + 3, '$', len - 3);
# 1148| if (!dollar)
# 1149| break;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/convert.c: scope_hint: In function ‘ident_to_worktree’
git-2.53.0/convert.c:1188:24: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1188 | dollar = memchr(src, '$', len);
# | ^
# 1186| for (;;) {
# 1187| /* step 1: run to the next '$' */
# 1188|-> dollar = memchr(src, '$', len);
# 1189| if (!dollar)
# 1190| break;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/convert.c:1188:24: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1186| for (;;) {
# 1187| /* step 1: run to the next '$' */
# 1188|-> dollar = memchr(src, '$', len);
# 1189| if (!dollar)
# 1190| break;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/convert.c:1211:32: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1211 | dollar = memchr(src + 3, '$', len - 3);
# | ^
# 1209| * for git-style ids.
# 1210| */
# 1211|-> dollar = memchr(src + 3, '$', len - 3);
# 1212| if (!dollar) {
# 1213| /* incomplete keyword, no more '$', so just quit the loop */
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/convert.c:1211:32: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1209| * for git-style ids.
# 1210| */
# 1211|-> dollar = memchr(src + 3, '$', len - 3);
# 1212| if (!dollar) {
# 1213| /* incomplete keyword, no more '$', so just quit the loop */
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/convert.c:1222:29: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1222 | spc = memchr(src + 4, ' ', dollar - src - 4);
# | ^
# 1220| }
# 1221|
# 1222|-> spc = memchr(src + 4, ' ', dollar - src - 4);
# 1223| if (spc && spc < dollar-1) {
# 1224| /* There are spaces in unexpected places.
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/convert.c:1222:29: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1220| }
# 1221|
# 1222|-> spc = memchr(src + 4, ' ', dollar - src - 4);
# 1223| if (spc && spc < dollar-1) {
# 1224| /* There are spaces in unexpected places.
Error: GCC_ANALYZER_WARNING (CWE-775):
git-2.53.0/diagnose.c:210:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(xopen(*zip_path.buf, 577, 438), 1)’
git-2.53.0/diagnose.c:198:12: branch_false: following ‘false’ branch (when ‘mode != 0’)...
git-2.53.0/diagnose.c:203:21: branch_false: ...to here
git-2.53.0/diagnose.c:204:12: branch_false: following ‘false’ branch (when ‘stdout_fd >= 0’)...
git-2.53.0/diagnose.c:209:29: branch_false: ...to here
git-2.53.0/diagnose.c:210:13: acquire_resource: opened here
git-2.53.0/diagnose.c:210:12: danger: ‘dup2(xopen(*zip_path.buf, 577, 438), 1)’ leaks here; was opened at [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
# 208|
# 209| archiver_fd = xopen(zip_path->buf, O_CREAT | O_WRONLY | O_TRUNC, 0666);
# 210|-> if (dup2(archiver_fd, STDOUT_FILENO) < 0) {
# 211| res = error_errno(_("could not redirect output"));
# 212| goto diagnose_cleanup;
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/diff-lib.c:322:22: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ce’
git-2.53.0/diff-lib.c:442:13: enter_function: entry to ‘do_oneway_diff’
git-2.53.0/diff-lib.c:453:12: branch_true: following ‘true’ branch...
git-2.53.0/diff-lib.c:454:13: branch_true: ...to here
git-2.53.0/diff-lib.c:453:13: branch_true: following ‘true’ branch...
git-2.53.0/diff-lib.c:453:13: branch_true: ...to here
git-2.53.0/diff-lib.c:462:18: branch_true: following ‘true’ branch...
git-2.53.0/diff-lib.c:462:18: branch_true: ...to here
git-2.53.0/diff-lib.c:467:12: branch_false: following ‘false’ branch...
git-2.53.0/diff-lib.c:479:12: branch_false: ...to here
git-2.53.0/diff-lib.c:479:12: branch_true: following ‘true’ branch (when ‘tree’ is NULL)...
git-2.53.0/diff-lib.c:480:17: branch_true: ...to here
git-2.53.0/diff-lib.c:480:17: call_function: calling ‘show_new_file’ from ‘do_oneway_diff’
# 320| {
# 321| const struct object_id *oid = &ce->oid;
# 322|-> unsigned int mode = ce->ce_mode;
# 323|
# 324| if (!cached && !ce_uptodate(ce)) {
Error: GCC_ANALYZER_WARNING (CWE-121):
git-2.53.0/diff-lib.c:599:17: warning[-Wanalyzer-out-of-bounds]: stack-based buffer overflow
git-2.53.0/diff-lib.c:586:20: branch_false: following ‘false’ branch...
git-2.53.0/diff-lib.c:584:43: branch_false: ...to here
git-2.53.0/diff-lib.c:595:12: branch_false: following ‘false’ branch...
git-2.53.0/diff-lib.c:595:12: branch_false: ...to here
git-2.53.0/diff-lib.c:598:21: branch_true: following ‘true’ branch...
git-2.53.0/diff-lib.c:599:72: branch_true: ...to here
git-2.53.0/diff-lib.c:598:21: branch_true: following ‘true’ branch...
git-2.53.0/diff-lib.c:599:72: branch_true: ...to here
git-2.53.0/diff-lib.c:598:21: branch_true: following ‘true’ branch...
git-2.53.0/diff-lib.c:599:72: branch_true: ...to here
git-2.53.0/diff-lib.c:599:17: danger: out-of-bounds write from byte 16 till byte 23 but ‘mb_child’ ends at byte 16
# 597|
# 598| for (i = 0; i < revs->pending.nr; i++)
# 599|-> mb_child[i] = lookup_commit_reference(the_repository, &revs->pending.objects[i].item->oid);
# 600| if (revs->pending.nr == 1) {
# 601| struct object_id oid;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/diff.c: scope_hint: In function ‘fn_out_diff_words_write_helper’
git-2.53.0/diff.c:1964:27: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 1964 | char *p = memchr(buf, '\n', count);
# | ^~~~~~
# 1962|
# 1963| while (count) {
# 1964|-> char *p = memchr(buf, '\n', count);
# 1965| if (print)
# 1966| strbuf_addstr(&sb, diff_line_prefix(o));
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/diff.c:1964:27: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 1962|
# 1963| while (count) {
# 1964|-> char *p = memchr(buf, '\n', count);
# 1965| if (print)
# 1966| strbuf_addstr(&sb, diff_line_prefix(o));
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/diff.c: scope_hint: In function ‘gather_dirstat’
git-2.53.0/diff.c:3058:23: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 3058 | slash = strchr(f->name + baselen, '/');
# | ^
# 3056| if (memcmp(f->name, base, baselen))
# 3057| break;
# 3058|-> slash = strchr(f->name + baselen, '/');
# 3059| if (slash) {
# 3060| int newbaselen = slash + 1 - f->name;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/diff.c:3058:23: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 3056| if (memcmp(f->name, base, baselen))
# 3057| break;
# 3058|-> slash = strchr(f->name + baselen, '/');
# 3059| if (slash) {
# 3060| int newbaselen = slash + 1 - f->name;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/diffcore-rename.c: scope_hint: In function ‘get_dirname’
git-2.53.0/diffcore-rename.c:382:23: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 382 | char *slash = strrchr(filename, '/');
# | ^~~~~~~
# 380| static char *get_dirname(const char *filename)
# 381| {
# 382|-> char *slash = strrchr(filename, '/');
# 383| return slash ? xstrndup(filename, slash - filename) : xstrdup("");
# 384| }
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/diffcore-rename.c:382:23: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 380| static char *get_dirname(const char *filename)
# 381| {
# 382|-> char *slash = strrchr(filename, '/');
# 383| return slash ? xstrndup(filename, slash - filename) : xstrdup("");
# 384| }
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/dir.c: scope_hint: In function ‘remove_path’
git-2.53.0/dir.c:3524:15: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 3524 | slash = strrchr(name, '/');
# | ^
# 3522| return -1;
# 3523|
# 3524|-> slash = strrchr(name, '/');
# 3525| if (slash) {
# 3526| char *dirs = xstrdup(name);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/dir.c:3524:15: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 3522| return -1;
# 3523|
# 3524|-> slash = strrchr(name, '/');
# 3525| if (slash) {
# 3526| char *dirs = xstrdup(name);
Error: GCC_ANALYZER_WARNING (CWE-416):
git-2.53.0/dir.c:3556:46: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘pl’
git-2.53.0/dir.c:3543:6: enter_function: entry to ‘dir_clear’
git-2.53.0/dir.c:3551:28: branch_true: following ‘true’ branch (when ‘i != 3’)...
git-2.53.0/dir.c:3551:28: branch_true: ...to here
git-2.53.0/dir.c:3555:28: branch_false: following ‘false’ branch (when ‘i != 1’)...
git-2.53.0/dir.c:3557:25: branch_false: ...to here
git-2.53.0/dir.c:3557:25: call_function: calling ‘clear_pattern_list’ from ‘dir_clear’
git-2.53.0/dir.c:3557:25: return_function: returning to ‘dir_clear’ from ‘clear_pattern_list’
git-2.53.0/dir.c:3553:29: branch_false: following ‘false’ branch...
git-2.53.0/dir.c:3559:22: branch_false: ...to here
git-2.53.0/dir.c:3559:17: release_memory: freed here
git-2.53.0/dir.c:3551:28: branch_true: following ‘true’ branch (when ‘i != 3’)...
git-2.53.0/dir.c:3551:28: branch_true: ...to here
git-2.53.0/dir.c:3553:29: branch_true: following ‘true’ branch...
git-2.53.0/dir.c:3554:31: branch_true: ...to here
git-2.53.0/dir.c:3555:28: branch_true: following ‘true’ branch (when ‘i == 1’)...
git-2.53.0/dir.c:3556:46: branch_true: ...to here
git-2.53.0/dir.c:3556:46: danger: use after ‘free’ of ‘pl’; freed at [(16)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/15)
# 3554| pl = &group->pl[j];
# 3555| if (i == EXC_DIRS)
# 3556|-> free((char *)pl->src);
# 3557| clear_pattern_list(pl);
# 3558| }
Error: GCC_ANALYZER_WARNING (CWE-415):
git-2.53.0/dir.c:3559:17: warning[-Wanalyzer-double-free]: double-‘free’ of ‘*dir.internal.exclude_list_group[i].pl’
git-2.53.0/dir.c:3543:6: enter_function: entry to ‘dir_clear’
git-2.53.0/dir.c:3551:28: branch_true: following ‘true’ branch (when ‘i != 3’)...
git-2.53.0/dir.c:3551:28: branch_true: ...to here
git-2.53.0/dir.c:3555:28: branch_false: following ‘false’ branch (when ‘i != 1’)...
git-2.53.0/dir.c:3557:25: branch_false: ...to here
git-2.53.0/dir.c:3557:25: call_function: calling ‘clear_pattern_list’ from ‘dir_clear’
git-2.53.0/dir.c:3557:25: return_function: returning to ‘dir_clear’ from ‘clear_pattern_list’
git-2.53.0/dir.c:3553:29: branch_false: following ‘false’ branch...
git-2.53.0/dir.c:3559:22: branch_false: ...to here
git-2.53.0/dir.c:3559:17: release_memory: first ‘free’ here
git-2.53.0/dir.c:3551:28: branch_true: following ‘true’ branch (when ‘i != 3’)...
git-2.53.0/dir.c:3551:28: branch_true: ...to here
git-2.53.0/dir.c:3553:29: branch_false: following ‘false’ branch...
git-2.53.0/dir.c:3559:22: branch_false: ...to here
git-2.53.0/dir.c:3559:17: danger: second ‘free’ here; first ‘free’ was at [(16)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/15)
# 3557| clear_pattern_list(pl);
# 3558| }
# 3559|-> free(group->pl);
# 3560| }
# 3561|
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/dir.c:3960:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ucd’
git-2.53.0/dir.c:3990:12: enter_function: entry to ‘invalidate_one_component’
git-2.53.0/dir.c:3996:12: branch_true: following ‘true’ branch (when ‘rest’ is non-NULL)...
git-2.53.0/dir.c:3997:37: branch_true: ...to here
git-2.53.0/dir.c:3999:25: call_function: calling ‘lookup_untracked’ from ‘invalidate_one_component’
git-2.53.0/dir.c:3999:25: return_function: returning to ‘invalidate_one_component’ from ‘lookup_untracked’
git-2.53.0/dir.c:4001:25: call_function: calling ‘invalidate_one_component’ from ‘invalidate_one_component’
# 3958| {
# 3959| uc->dir_invalidated++;
# 3960|-> ucd->valid = 0;
# 3961| for (size_t i = 0; i < ucd->untracked_nr; i++)
# 3962| free(ucd->untracked[i]);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/fmt-merge-msg.c: scope_hint: In function ‘record_person_from_buf’
git-2.53.0/fmt-merge-msg.c:254:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 254 | name = strstr(buffer, field);
# | ^
# 252|
# 253| field = (which == 'a') ? "\nauthor " : "\ncommitter ";
# 254|-> name = strstr(buffer, field);
# 255| if (!name)
# 256| return;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/fmt-merge-msg.c:254:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 252|
# 253| field = (which == 'a') ? "\nauthor " : "\ncommitter ";
# 254|-> name = strstr(buffer, field);
# 255| if (!name)
# 256| return;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/fsck.c: scope_hint: In function ‘fsck_tag_standalone’
git-2.53.0/fsck.c:1058:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1058 | eol = memchr(buffer, '\n', buffer_end - buffer);
# | ^
# 1056| goto done;
# 1057| }
# 1058|-> eol = memchr(buffer, '\n', buffer_end - buffer);
# 1059| if (!eol) {
# 1060| ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_TYPE, "invalid format - unexpected end after 'type' line");
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/fsck.c:1058:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1056| goto done;
# 1057| }
# 1058|-> eol = memchr(buffer, '\n', buffer_end - buffer);
# 1059| if (!eol) {
# 1060| ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_TYPE, "invalid format - unexpected end after 'type' line");
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/fsck.c:1074:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1074 | eol = memchr(buffer, '\n', buffer_end - buffer);
# | ^
# 1072| goto done;
# 1073| }
# 1074|-> eol = memchr(buffer, '\n', buffer_end - buffer);
# 1075| if (!eol) {
# 1076| ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_TAG, "invalid format - unexpected end after 'type' line");
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/fsck.c:1074:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1072| goto done;
# 1073| }
# 1074|-> eol = memchr(buffer, '\n', buffer_end - buffer);
# 1075| if (!eol) {
# 1076| ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_TAG, "invalid format - unexpected end after 'type' line");
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/fsck.c:1100:21: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1100 | eol = memchr(buffer, '\n', buffer_end - buffer);
# | ^
# 1098|
# 1099| if (buffer < buffer_end && (skip_prefix(buffer, "gpgsig ", &buffer) || skip_prefix(buffer, "gpgsig-sha256 ", &buffer))) {
# 1100|-> eol = memchr(buffer, '\n', buffer_end - buffer);
# 1101| if (!eol) {
# 1102| ret = report(options, oid, OBJ_TAG, FSCK_MSG_BAD_GPGSIG, "invalid format - unexpected end after 'gpgsig' or 'gpgsig-sha256' line");
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/fsck.c:1100:21: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1098|
# 1099| if (buffer < buffer_end && (skip_prefix(buffer, "gpgsig ", &buffer) || skip_prefix(buffer, "gpgsig-sha256 ", &buffer))) {
# 1100|-> eol = memchr(buffer, '\n', buffer_end - buffer);
# 1101| if (!eol) {
# 1102| ret = report(options, oid, OBJ_TAG, FSCK_MSG_BAD_GPGSIG, "invalid format - unexpected end after 'gpgsig' or 'gpgsig-sha256' line");
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/fsck.c:1108:29: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1108 | eol = memchr(buffer, '\n', buffer_end - buffer);
# | ^
# 1106|
# 1107| while (buffer < buffer_end && starts_with(buffer, " ")) {
# 1108|-> eol = memchr(buffer, '\n', buffer_end - buffer);
# 1109| if (!eol) {
# 1110| ret = report(options, oid, OBJ_TAG, FSCK_MSG_BAD_HEADER_CONTINUATION, "invalid format - unexpected end in 'gpgsig' or 'gpgsig-sha256' continuation line");
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/fsck.c:1108:29: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1106|
# 1107| while (buffer < buffer_end && starts_with(buffer, " ")) {
# 1108|-> eol = memchr(buffer, '\n', buffer_end - buffer);
# 1109| if (!eol) {
# 1110| ret = report(options, oid, OBJ_TAG, FSCK_MSG_BAD_HEADER_CONTINUATION, "invalid format - unexpected end in 'gpgsig' or 'gpgsig-sha256' continuation line");
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/kwset.c:37: included_from: Included from here.
git-2.53.0/git-compat-util.h: scope_hint: In function ‘git_find_last_dir_sep’
git-2.53.0/git-compat-util.h:344:16: warning[-Wdiscarded-qualifiers]: return discards ‘const’ qualifier from pointer target type
# 344 | return strrchr(path, '/');
# | ^~~~~~~
# 342| static inline char *git_find_last_dir_sep(const char *path)
# 343| {
# 344|-> return strrchr(path, '/');
# 345| }
# 346| #define find_last_dir_sep git_find_last_dir_sep
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/git-compat-util.h:344:16: warning[-Wdiscarded-qualifiers]: return discards ‘const’ qualifier from pointer target type
# 342| static inline char *git_find_last_dir_sep(const char *path)
# 343| {
# 344|-> return strrchr(path, '/');
# 345| }
# 346| #define find_last_dir_sep git_find_last_dir_sep
Error: GCC_ANALYZER_WARNING (CWE-688):
git-2.53.0/git-compat-util.h:731:17: warning[-Wanalyzer-null-argument]: use of NULL ‘dst’ where non-null expected
git-2.53.0/split-index.c:163:6: enter_function: entry to ‘merge_base_index’
git-2.53.0/split-index.c:173:9: release_memory: ‘*istate.cache’ is NULL
git-2.53.0/split-index.c:175:9: branch_false: following ‘false’ branch...
git-2.53.0/split-index.c:176:9: branch_false: ...to here
git-2.53.0/split-index.c:176:9: release_memory: ‘*istate.cache’ is NULL
git-2.53.0/split-index.c:176:9: call_function: inlined call to ‘copy_array’ from ‘merge_base_index’
# 729| {
# 730| if (n)
# 731|-> memcpy(dst, src, st_mult(size, n));
# 732| }
# 733|
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/gpg-interface.c: scope_hint: In function ‘parse_ssh_output’
git-2.53.0/gpg-interface.c:444:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 444 | key = strstr(line, "key ");
# | ^
# 442| }
# 443|
# 444|-> key = strstr(line, "key ");
# 445| if (key) {
# 446| sigc->fingerprint = xstrdup(key + 4);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/gpg-interface.c:444:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 442| }
# 443|
# 444|-> key = strstr(line, "key ");
# 445| if (key) {
# 446| sigc->fingerprint = xstrdup(key + 4);
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/graph.c:1115:46: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘parents’
git-2.53.0/graph.c:1519:6: enter_function: entry to ‘graph_show_commit_msg’
git-2.53.0/graph.c:1528:9: call_function: calling ‘graph_show_strbuf’ from ‘graph_show_commit_msg’
# 1113|
# 1114| for (j = 0; j < graph->num_parents; j++) {
# 1115|-> par_column = graph_find_new_column_by_commit(graph, parents->item);
# 1116| assert(par_column >= 0);
# 1117|
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/graph.c:1148:35: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
git-2.53.0/graph.c:1519:6: enter_function: entry to ‘graph_show_commit_msg’
git-2.53.0/graph.c:1528:9: call_function: calling ‘graph_show_strbuf’ from ‘graph_show_commit_msg’
# 1146| }
# 1147|
# 1148|-> if (col_commit == first_parent->item)
# 1149| parent_col = col;
# 1150| }
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/help.c: scope_hint: In function ‘append_similar_ref’
git-2.53.0/help.c:860:24: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 860 | char *branch = strrchr(ref->name, '/') + 1;
# | ^~~~~~~
# 858| {
# 859| struct similar_ref_cb *cb = (struct similar_ref_cb *)(cb_data);
# 860|-> char *branch = strrchr(ref->name, '/') + 1;
# 861|
# 862| /* A remote branch of the same name is deemed similar */
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/help.c:860:24: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 858| {
# 859| struct similar_ref_cb *cb = (struct similar_ref_cb *)(cb_data);
# 860|-> char *branch = strrchr(ref->name, '/') + 1;
# 861|
# 862| /* A remote branch of the same name is deemed similar */
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/http-push.c: scope_hint: In function ‘cmd_main’
git-2.53.0/http-push.c:1771:38: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 1771 | char *path = strstr(arg, "//");
# | ^~~~~~
# 1769| }
# 1770| if (!repo->url) {
# 1771|-> char *path = strstr(arg, "//");
# 1772| str_end_url_with_slash(arg, &repo->url);
# 1773| repo->path_len = strlen(repo->url);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/http-push.c:1771:38: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 1769| }
# 1770| if (!repo->url) {
# 1771|-> char *path = strstr(arg, "//");
# 1772| str_end_url_with_slash(arg, &repo->url);
# 1773| repo->path_len = strlen(repo->url);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/http.c: scope_hint: In function ‘redact_sensitive_header’
git-2.53.0/http.c:755:43: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 755 | char *semicolon = strstr(cookie, "; ");
# | ^~~~~~
# 753| while (cookie) {
# 754| char *equals;
# 755|-> char *semicolon = strstr(cookie, "; ");
# 756| if (semicolon)
# 757| *semicolon = 0;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/http.c:755:43: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 753| while (cookie) {
# 754| char *equals;
# 755|-> char *semicolon = strstr(cookie, "; ");
# 756| if (semicolon)
# 757| *semicolon = 0;
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/line-log.c:160:43: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘rb’
git-2.53.0/line-log.c:1314:5: enter_function: entry to ‘line_log_filter’
git-2.53.0/line-log.c:1320:16: branch_true: following ‘true’ branch (when ‘list’ is non-NULL)...
git-2.53.0/line-log.c:1322:17: branch_true: ...to here
git-2.53.0/line-log.c:1323:21: call_function: calling ‘line_log_process_ranges_arbitrary_commit’ from ‘line_log_filter’
# 158| struct range *new_range;
# 159| if (i < a->nr && j < b->nr) {
# 160|-> if (ra[i].start < rb[j].start)
# 161| new_range = &ra[i++];
# 162| else if (ra[i].start > rb[j].start)
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/line-log.c:172:21: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘new_range’
git-2.53.0/line-log.c:1314:5: enter_function: entry to ‘line_log_filter’
git-2.53.0/line-log.c:1320:16: branch_true: following ‘true’ branch (when ‘list’ is non-NULL)...
git-2.53.0/line-log.c:1322:17: branch_true: ...to here
git-2.53.0/line-log.c:1323:21: call_function: calling ‘line_log_process_ranges_arbitrary_commit’ from ‘line_log_filter’
# 170| else /* a exhausted */
# 171| new_range = &rb[j++];
# 172|-> if (new_range->start == new_range->end)
# 173| ; /* empty range */
# 174| else if (!out->nr || out->ranges[out->nr-1].end < new_range->start) {
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/mailinfo.c: scope_hint: In function ‘output_header_lines’
git-2.53.0/mailinfo.c:1144:28: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 1144 | char *ep = strchr(sp, '\n');
# | ^~~~~~
# 1142| const char *sp = data->buf;
# 1143| while (1) {
# 1144|-> char *ep = strchr(sp, '\n');
# 1145| int len;
# 1146| if (!ep)
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/mailinfo.c:1144:28: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 1142| const char *sp = data->buf;
# 1143| while (1) {
# 1144|-> char *ep = strchr(sp, '\n');
# 1145| int len;
# 1146| if (!ep)
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/mem-pool.c: scope_hint: In function ‘mem_pool_strndup’
git-2.53.0/mem-pool.c:172:19: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 172 | char *p = memchr(str, '\0', len);
# | ^~~~~~
# 170| char *mem_pool_strndup(struct mem_pool *pool, const char *str, size_t len)
# 171| {
# 172|-> char *p = memchr(str, '\0', len);
# 173| size_t actual_len = (p ? p - str : len);
# 174| char *ret = mem_pool_alloc(pool, actual_len+1);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/mem-pool.c:172:19: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 170| char *mem_pool_strndup(struct mem_pool *pool, const char *str, size_t len)
# 171| {
# 172|-> char *p = memchr(str, '\0', len);
# 173| size_t actual_len = (p ? p - str : len);
# 174| char *ret = mem_pool_alloc(pool, actual_len+1);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/merge-ort.c: scope_hint: In function ‘apply_directory_rename_modifications’
git-2.53.0/merge-ort.c:2734:36: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 2734 | char *last_slash = strrchr(cur_path, '/');
# | ^~~~~~~
# 2732| while (1) {
# 2733| /* Find the parent directory of cur_path */
# 2734|-> char *last_slash = strrchr(cur_path, '/');
# 2735| if (last_slash) {
# 2736| parent_name = mem_pool_strndup(&opt->priv->pool,
Error: GCC_ANALYZER_WARNING (CWE-1341):
git-2.53.0/midx.c:225:17: warning[-Wanalyzer-fd-double-close]: double ‘close’ of file descriptor ‘git_open_cloexec(midx_name, 0)’
git-2.53.0/midx.c:860:5: enter_function: entry to ‘verify_midx_file’
git-2.53.0/midx.c:866:38: call_function: calling ‘load_multi_pack_index’ from ‘verify_midx_file’
# 223| munmap(midx_map, midx_size);
# 224| if (0 <= fd)
# 225|-> close(fd);
# 226| return NULL;
# 227| }
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/object-name.c: scope_hint: In function ‘repo_interpret_branch_name’
git-2.53.0/object-name.c:1780:18: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1780 | (at = memchr(start, '@', namelen - (start - name)));
# | ^
# 1778|
# 1779| for (start = name;
# 1780|-> (at = memchr(start, '@', namelen - (start - name)));
# 1781| start = at + 1) {
# 1782|
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/object-name.c:1780:18: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1778|
# 1779| for (start = name;
# 1780|-> (at = memchr(start, '@', namelen - (start - name)));
# 1781| start = at + 1) {
# 1782|
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/pack-bitmap.c:526:39: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘*bitmap_git.base’
git-2.53.0/pack-bitmap.c:3057:5: enter_function: entry to ‘test_bitmap_pseudo_merge_objects’
git-2.53.0/pack-bitmap.c:3063:22: call_function: calling ‘prepare_bitmap_git’ from ‘test_bitmap_pseudo_merge_objects’
# 524| if (midx->base_midx) {
# 525| bitmap_git->base = prepare_midx_bitmap_git(midx->base_midx);
# 526|-> bitmap_git->base_nr = bitmap_git->base->base_nr + 1;
# 527| } else {
# 528| bitmap_git->base_nr = 0;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/pack-revindex.c: scope_hint: In function ‘midx_key_to_pack_pos’
git-2.53.0/pack-revindex.c:564:15: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 564 | found = bsearch(key, m->revindex_data, m->num_objects,
# | ^
# 562| return error(_("could not determine preferred pack"));
# 563|
# 564|-> found = bsearch(key, m->revindex_data, m->num_objects,
# 565| sizeof(*m->revindex_data),
# 566| midx_pack_order_cmp);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/pack-revindex.c:564:15: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 562| return error(_("could not determine preferred pack"));
# 563|
# 564|-> found = bsearch(key, m->revindex_data, m->num_objects,
# 565| sizeof(*m->revindex_data),
# 566| midx_pack_order_cmp);
Error: GCC_ANALYZER_WARNING:
git-2.53.0/pager.c:55:9: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘1’
git-2.53.0/pager.c:47:6: enter_function: entry to ‘wait_for_pager’
git-2.53.0/pager.c:49:12: branch_false: following ‘false’ branch...
git-2.53.0/pager.c:52:9: branch_false: ...to here
git-2.53.0/pager.c:52:9: call_function: calling ‘finish_pager’ from ‘wait_for_pager’
git-2.53.0/pager.c:52:9: return_function: returning to ‘wait_for_pager’ from ‘finish_pager’
git-2.53.0/pager.c:55:9: danger: ‘1’ could be invalid
# 53| sigchain_pop_common();
# 54| unsetenv("GIT_PAGER_IN_USE");
# 55|-> dup2(old_fd1, 1);
# 56| close(old_fd1);
# 57| old_fd1 = -1;
Error: GCC_ANALYZER_WARNING:
git-2.53.0/pager.c:59:17: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘2’
git-2.53.0/pager.c:47:6: enter_function: entry to ‘wait_for_pager’
git-2.53.0/pager.c:49:12: branch_false: following ‘false’ branch...
git-2.53.0/pager.c:52:9: branch_false: ...to here
git-2.53.0/pager.c:52:9: call_function: calling ‘finish_pager’ from ‘wait_for_pager’
git-2.53.0/pager.c:52:9: return_function: returning to ‘wait_for_pager’ from ‘finish_pager’
git-2.53.0/pager.c:58:12: branch_true: following ‘true’ branch...
git-2.53.0/pager.c:59:17: branch_true: ...to here
git-2.53.0/pager.c:59:17: danger: ‘2’ could be invalid
# 57| old_fd1 = -1;
# 58| if (old_fd2 != -1) {
# 59|-> dup2(old_fd2, 2);
# 60| close(old_fd2);
# 61| old_fd2 = -1;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/pager.c: scope_hint: In function ‘setup_pager_env’
git-2.53.0/pager.c:121:28: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 121 | char *cp = strchr(argv[i], '=');
# | ^~~~~~
# 119|
# 120| for (i = 0; i < n; i++) {
# 121|-> char *cp = strchr(argv[i], '=');
# 122|
# 123| if (!cp)
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/pager.c:121:28: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 119|
# 120| for (i = 0; i < n; i++) {
# 121|-> char *cp = strchr(argv[i], '=');
# 122|
# 123| if (!cp)
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/pkt-line.c: scope_hint: In function ‘find_packfile_uri_path’
git-2.53.0/pkt-line.c:401:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 401 | path = strstr(buffer + len + 1, URI_MARK);
# | ^
# 399| return NULL; /* required "<hash>SP" not seen */
# 400|
# 401|-> path = strstr(buffer + len + 1, URI_MARK);
# 402| if (!path)
# 403| return NULL;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/pkt-line.c:401:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 399| return NULL; /* required "<hash>SP" not seen */
# 400|
# 401|-> path = strstr(buffer + len + 1, URI_MARK);
# 402| if (!path)
# 403| return NULL;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/pseudo-merge.c: scope_hint: In function ‘find_pseudo_merge’
git-2.53.0/pseudo-merge.c:647:16: warning[-Wdiscarded-qualifiers]: return discards ‘const’ qualifier from pointer target type
# 647 | return bsearch(&pos, pm->commits, pm->commits_nr,
# | ^~~~~~~
# 645| return NULL;
# 646|
# 647|-> return bsearch(&pos, pm->commits, pm->commits_nr,
# 648| PSEUDO_MERGE_COMMIT_RAWSZ, pseudo_merge_commit_cmp);
# 649| }
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/pseudo-merge.c:647:16: warning[-Wdiscarded-qualifiers]: return discards ‘const’ qualifier from pointer target type
# 645| return NULL;
# 646|
# 647|-> return bsearch(&pos, pm->commits, pm->commits_nr,
# 648| PSEUDO_MERGE_COMMIT_RAWSZ, pseudo_merge_commit_cmp);
# 649| }
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/range-diff.c: scope_hint: In function ‘read_patches’
git-2.53.0/range-diff.c:109:50: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 109 | if (include_merges && (q = strstr(p, " (from ")))
# | ^
# 107| }
# 108| CALLOC_ARRAY(util, 1);
# 109|-> if (include_merges && (q = strstr(p, " (from ")))
# 110| *q = '\0';
# 111| if (repo_get_oid(the_repository, p, &util->oid)) {
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/range-diff.c:109:50: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 107| }
# 108| CALLOC_ARRAY(util, 1);
# 109|-> if (include_merges && (q = strstr(p, " (from ")))
# 110| *q = '\0';
# 111| if (repo_get_oid(the_repository, p, &util->oid)) {
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/read-cache.h:42:31: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ce’
git-2.53.0/diff-lib.c:517:12: enter_function: entry to ‘oneway_diff’
git-2.53.0/diff-lib.c:530:12: branch_true: following ‘true’ branch...
git-2.53.0/diff-lib.c:530:12: branch_true: ...to here
git-2.53.0/diff-lib.c:533:13: branch_false: following ‘false’ branch (when ‘idx’ is NULL)...
git-2.53.0/diff-lib.c:533:13: branch_false: ...to here
git-2.53.0/diff-lib.c:533:13: call_function: calling ‘ce_path_match’ from ‘oneway_diff’
# 40| {
# 41| return match_pathspec(istate, pathspec, ce->name, ce_namelen(ce), 0, seen,
# 42|-> S_ISDIR(ce->ce_mode) || S_ISGITLINK(ce->ce_mode));
# 43| }
# 44|
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/ref-filter.c: scope_hint: In function ‘rstrip_ref_components’
git-2.53.0/ref-filter.c:2237:27: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 2237 | char *p = strrchr(start, '/');
# | ^~~~~~~
# 2235|
# 2236| while (remaining-- > 0) {
# 2237|-> char *p = strrchr(start, '/');
# 2238| if (!p) {
# 2239| free((char *)to_free);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/ref-filter.c:2237:27: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 2235|
# 2236| while (remaining-- > 0) {
# 2237|-> char *p = strrchr(start, '/');
# 2238| if (!p) {
# 2239| free((char *)to_free);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/reflog-walk.c: scope_hint: In function ‘add_reflog_for_walk’
git-2.53.0/reflog-walk.c:160:29: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 160 | char *branch, *at = strchr(name, '@');
# | ^~~~~~
# 158| struct string_list_item *item;
# 159| struct complete_reflogs *reflogs;
# 160|-> char *branch, *at = strchr(name, '@');
# 161| struct commit_reflog *commit_reflog;
# 162| enum selector_type selector = SELECTOR_NONE;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/reflog-walk.c:160:29: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 158| struct string_list_item *item;
# 159| struct complete_reflogs *reflogs;
# 160|-> char *branch, *at = strchr(name, '@');
# 161| struct commit_reflog *commit_reflog;
# 162| enum selector_type selector = SELECTOR_NONE;
Error: GCC_ANALYZER_WARNING (CWE-126):
git-2.53.0/refs.c:2661:31: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read
git-2.53.0/refs.c:2793:28: enter_function: entry to ‘refs_verify_refname_available’
git-2.53.0/refs.c:2807:16: call_function: calling ‘refs_verify_refnames_available’ from ‘refs_verify_refname_available’
# 2659|
# 2660| for_each_string_list_item(item, refnames) {
# 2661|-> const size_t *update_idx = (size_t *)item->util;
# 2662| const char *refname = item->string;
# 2663| const char *extra_refname;
Error: GCC_ANALYZER_WARNING (CWE-126):
git-2.53.0/refs.c:2662:29: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read
git-2.53.0/refs.c:2793:28: enter_function: entry to ‘refs_verify_refname_available’
git-2.53.0/refs.c:2807:16: call_function: calling ‘refs_verify_refnames_available’ from ‘refs_verify_refname_available’
# 2660| for_each_string_list_item(item, refnames) {
# 2661| const size_t *update_idx = (size_t *)item->util;
# 2662|-> const char *refname = item->string;
# 2663| const char *extra_refname;
# 2664| struct object_id oid;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/refs/files-backend.c: scope_hint: In function ‘show_one_reflog_ent’
git-2.53.0/refs/files-backend.c:2192:25: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2192 | !(email_end = strchr(p, '>')) ||
# | ^
# 2190| parse_oid_hex_algop(p, &ooid, &p, refs->base.repo->hash_algo) || *p++ != ' ' ||
# 2191| parse_oid_hex_algop(p, &noid, &p, refs->base.repo->hash_algo) || *p++ != ' ' ||
# 2192|-> !(email_end = strchr(p, '>')) ||
# 2193| email_end[1] != ' ' ||
# 2194| !(timestamp = parse_timestamp(email_end + 2, &message, 10)) ||
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/refs/files-backend.c:2192:25: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2190| parse_oid_hex_algop(p, &ooid, &p, refs->base.repo->hash_algo) || *p++ != ' ' ||
# 2191| parse_oid_hex_algop(p, &noid, &p, refs->base.repo->hash_algo) || *p++ != ' ' ||
# 2192|-> !(email_end = strchr(p, '>')) ||
# 2193| email_end[1] != ' ' ||
# 2194| !(timestamp = parse_timestamp(email_end + 2, &message, 10)) ||
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/refs/packed-backend.c:184:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
git-2.53.0/refs/packed-backend.c:2060:12: enter_function: entry to ‘packed_fsck’
git-2.53.0/refs/packed-backend.c:2064:41: call_function: calling ‘packed_downcast’ from ‘packed_fsck’
git-2.53.0/refs/packed-backend.c:2064:41: return_function: returning to ‘packed_fsck’ from ‘packed_downcast’
git-2.53.0/refs/packed-backend.c:2072:12: branch_false: following ‘false’ branch...
git-2.53.0/refs/packed-backend.c:2075:13: branch_false: ...to here
git-2.53.0/refs/packed-backend.c:2079:12: branch_false: following ‘false’ branch...
git-2.53.0/refs/packed-backend.c:2098:20: branch_false: ...to here
git-2.53.0/refs/packed-backend.c:2098:19: branch_false: following ‘false’ branch...
git-2.53.0/refs/packed-backend.c:2101:21: branch_false: ...to here
git-2.53.0/refs/packed-backend.c:2101:19: branch_false: following ‘false’ branch...
git-2.53.0/refs/packed-backend.c:2110:14: branch_false: ...to here
git-2.53.0/refs/packed-backend.c:2110:14: call_function: calling ‘allocate_snapshot_buffer’ from ‘packed_fsck’
git-2.53.0/refs/packed-backend.c:2110:14: return_function: returning to ‘packed_fsck’ from ‘allocate_snapshot_buffer’
git-2.53.0/refs/packed-backend.c:2110:12: branch_false: following ‘false’ branch...
git-2.53.0/refs/packed-backend.c:2120:39: branch_false: ...to here
git-2.53.0/refs/packed-backend.c:2121:13: branch_false: following ‘false’ branch...
git-2.53.0/refs/packed-backend.c:2125:1: branch_false: ...to here
git-2.53.0/refs/packed-backend.c:2126:12: branch_true: following ‘true’ branch...
git-2.53.0/refs/packed-backend.c:2127:17: branch_true: ...to here
git-2.53.0/refs/packed-backend.c:2128:9: call_function: calling ‘clear_snapshot_buffer’ from ‘packed_fsck’
# 182| if (snapshot->mmapped) {
# 183| if (munmap(snapshot->buf, snapshot->eof - snapshot->buf))
# 184|-> die_errno("error ummapping packed-refs file %s",
# 185| snapshot->refs->path);
# 186| snapshot->mmapped = 0;
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/refs/packed-backend.c:533:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
git-2.53.0/refs/packed-backend.c:2060:12: enter_function: entry to ‘packed_fsck’
git-2.53.0/refs/packed-backend.c:2064:41: call_function: calling ‘packed_downcast’ from ‘packed_fsck’
git-2.53.0/refs/packed-backend.c:2064:41: return_function: returning to ‘packed_fsck’ from ‘packed_downcast’
git-2.53.0/refs/packed-backend.c:2072:12: branch_false: following ‘false’ branch...
git-2.53.0/refs/packed-backend.c:2075:13: branch_false: ...to here
git-2.53.0/refs/packed-backend.c:2079:12: branch_false: following ‘false’ branch...
git-2.53.0/refs/packed-backend.c:2098:20: branch_false: ...to here
git-2.53.0/refs/packed-backend.c:2098:19: branch_false: following ‘false’ branch...
git-2.53.0/refs/packed-backend.c:2101:21: branch_false: ...to here
git-2.53.0/refs/packed-backend.c:2101:19: branch_false: following ‘false’ branch...
git-2.53.0/refs/packed-backend.c:2110:14: branch_false: ...to here
git-2.53.0/refs/packed-backend.c:2110:14: call_function: calling ‘allocate_snapshot_buffer’ from ‘packed_fsck’
# 531| bytes_read = read_in_full(fd, snapshot->buf, size);
# 532| if (bytes_read < 0 || bytes_read != size)
# 533|-> die_errno("couldn't read %s", snapshot->refs->path);
# 534| snapshot->mmapped = 0;
# 535| } else {
Error: GCC_ANALYZER_WARNING (CWE-122):
git-2.53.0/reftable/basics.c:238:9: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
git-2.53.0/reftable/basics.c:198:5: enter_function: entry to ‘parse_names’
git-2.53.0/reftable/basics.c:207:16: branch_true: following ‘true’ branch (when ‘p < end’)...
git-2.53.0/reftable/basics.c:208:30: branch_true: ...to here
git-2.53.0/reftable/basics.c:209:20: branch_false: following ‘false’ branch (when ‘next’ is non-NULL)...
git-2.53.0/reftable/basics.c:212:27: branch_false: ...to here
git-2.53.0/reftable/basics.c:212:27: branch_true: following ‘true’ branch (when ‘end > next’)...
git-2.53.0/reftable/basics.c:213:25: branch_true: ...to here
git-2.53.0/reftable/basics.c:218:20: branch_true: following ‘true’ branch (when ‘p < next’)...
git-2.53.0/reftable/basics.c:219:29: branch_true: ...to here
git-2.53.0/reftable/basics.c:219:28: branch_true: following ‘true’ branch...
git-2.53.0/reftable/basics.c:219:29: branch_true: ...to here
git-2.53.0/reftable/basics.c:219:29: call_function: calling ‘reftable_alloc_grow’ from ‘parse_names’
git-2.53.0/reftable/basics.c:219:29: return_function: returning to ‘parse_names’ from ‘reftable_alloc_grow’
git-2.53.0/reftable/basics.c:219:29: branch_false: following ‘false’ branch...
git-2.53.0/reftable/basics.c:225:30: branch_false: ...to here
git-2.53.0/reftable/basics.c:225:44: call_function: calling ‘reftable_strdup’ from ‘parse_names’
git-2.53.0/reftable/basics.c:225:44: return_function: returning to ‘parse_names’ from ‘reftable_strdup’
git-2.53.0/reftable/basics.c:226:28: branch_false: following ‘false’ branch...
git-2.53.0/reftable/basics.c:231:17: branch_false: ...to here
git-2.53.0/reftable/basics.c:234:12: branch_false: following ‘false’ branch...
git-2.53.0/reftable/basics.c:238:14: branch_false: ...to here
git-2.53.0/reftable/basics.c:238:9: danger: out-of-bounds write from byte 8 till byte 15 but region ends at byte 8
# 236| goto done;
# 237| }
# 238|-> names[names_len] = NULL;
# 239|
# 240| *out = names;
Error: GCC_ANALYZER_WARNING (CWE-416):
git-2.53.0/reftable/basics.c:244:17: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘names’
git-2.53.0/reftable/basics.c:198:5: enter_function: entry to ‘parse_names’
git-2.53.0/reftable/basics.c:207:16: branch_true: following ‘true’ branch (when ‘p < end’)...
git-2.53.0/reftable/basics.c:208:30: branch_true: ...to here
git-2.53.0/reftable/basics.c:209:20: branch_false: following ‘false’ branch (when ‘next’ is non-NULL)...
git-2.53.0/reftable/basics.c:212:27: branch_false: ...to here
git-2.53.0/reftable/basics.c:212:27: branch_true: following ‘true’ branch (when ‘end > next’)...
git-2.53.0/reftable/basics.c:213:25: branch_true: ...to here
git-2.53.0/reftable/basics.c:218:20: branch_true: following ‘true’ branch (when ‘p < next’)...
git-2.53.0/reftable/basics.c:219:29: branch_true: ...to here
git-2.53.0/reftable/basics.c:219:28: branch_true: following ‘true’ branch...
git-2.53.0/reftable/basics.c:219:29: branch_true: ...to here
git-2.53.0/reftable/basics.c:219:29: call_function: calling ‘reftable_alloc_grow’ from ‘parse_names’
git-2.53.0/reftable/basics.c:219:29: return_function: returning to ‘parse_names’ from ‘reftable_alloc_grow’
git-2.53.0/reftable/basics.c:219:29: branch_false: following ‘false’ branch...
git-2.53.0/reftable/basics.c:225:30: branch_false: ...to here
git-2.53.0/reftable/basics.c:225:44: call_function: calling ‘reftable_strdup’ from ‘parse_names’
git-2.53.0/reftable/basics.c:225:44: return_function: returning to ‘parse_names’ from ‘reftable_strdup’
git-2.53.0/reftable/basics.c:226:28: branch_false: following ‘false’ branch...
git-2.53.0/reftable/basics.c:231:17: branch_false: ...to here
git-2.53.0/reftable/basics.c:234:12: branch_true: following ‘true’ branch...
git-2.53.0/reftable/basics.c:234:13: branch_true: ...to here
git-2.53.0/reftable/basics.c:234:13: call_function: calling ‘reftable_alloc_grow’ from ‘parse_names’
git-2.53.0/reftable/basics.c:234:13: return_function: returning to ‘parse_names’ from ‘reftable_alloc_grow’
git-2.53.0/reftable/basics.c:234:13: branch_true: following ‘true’ branch...
git-2.53.0/reftable/basics.c:236:17: branch_true: ...to here
git-2.53.0/reftable/basics.c:243:28: branch_true: following ‘true’ branch (when ‘names_len > i’)...
git-2.53.0/reftable/basics.c:244:36: branch_true: ...to here
git-2.53.0/reftable/basics.c:244:17: danger: use after ‘free’ of ‘names + i * 8’; freed at [(61)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/60)
# 242| done:
# 243| for (size_t i = 0; i < names_len; i++)
# 244|-> reftable_free(names[i]);
# 245| reftable_free(names);
# 246| return err;
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/reftable/stack.c:315:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘cur’
git-2.53.0/reftable/stack.c:647:5: enter_function: entry to ‘reftable_stack_reload’
git-2.53.0/reftable/stack.c:651:24: call_function: calling ‘reftable_stack_reload_maybe_reuse’ from ‘reftable_stack_reload’
# 313| }
# 314|
# 315|-> new_tables[new_tables_len] = table;
# 316| new_tables_len++;
# 317| }
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/reftable/stack.c:315:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘new_tables’
git-2.53.0/reftable/stack.c:647:5: enter_function: entry to ‘reftable_stack_reload’
git-2.53.0/reftable/stack.c:651:24: call_function: calling ‘reftable_stack_reload_maybe_reuse’ from ‘reftable_stack_reload’
# 313| }
# 314|
# 315|-> new_tables[new_tables_len] = table;
# 316| new_tables_len++;
# 317| }
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/reftable/stack.c:315:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘reused’
git-2.53.0/reftable/stack.c:647:5: enter_function: entry to ‘reftable_stack_reload’
git-2.53.0/reftable/stack.c:651:24: call_function: calling ‘reftable_stack_reload_maybe_reuse’ from ‘reftable_stack_reload’
# 313| }
# 314|
# 315|-> new_tables[new_tables_len] = table;
# 316| new_tables_len++;
# 317| }
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/remote.c:1996:29: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
git-2.53.0/remote.c:2054:5: enter_function: entry to ‘get_fetch_map’
git-2.53.0/remote.c:2061:12: branch_false: following ‘false’ branch...
git-2.53.0/remote.c:2064:13: branch_false: ...to here
git-2.53.0/remote.c:2064:12: branch_true: following ‘true’ branch...
git-2.53.0/remote.c:2065:27: branch_true: ...to here
git-2.53.0/remote.c:2065:27: call_function: calling ‘get_expanded_map’ from ‘get_fetch_map’
# 1994| struct ref *cpy = copy_ref(ref);
# 1995|
# 1996|-> if (cpy->peer_ref)
# 1997| free_one_ref(cpy->peer_ref);
# 1998| cpy->peer_ref = alloc_ref(expn_name);
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/remote.c:1996:29: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ret’
git-2.53.0/remote.c:1976:20: enter_function: entry to ‘get_expanded_map’
git-2.53.0/remote.c:1981:21: release_memory: ‘ret’ is NULL
git-2.53.0/remote.c:1984:33: branch_true: following ‘true’ branch (when ‘ref’ is non-NULL)...
git-2.53.0/remote.c:1985:23: branch_true: ...to here
git-2.53.0/remote.c:1987:17: call_function: calling ‘strbuf_setlen’ from ‘get_expanded_map’
git-2.53.0/remote.c:1987:17: return_function: returning to ‘get_expanded_map’ from ‘strbuf_setlen’
git-2.53.0/remote.c:1989:20: branch_false: following ‘false’ branch...
git-2.53.0/remote.c:1992:45: branch_false: ...to here
git-2.53.0/remote.c:1984:33: branch_true: following ‘true’ branch (when ‘ref’ is non-NULL)...
git-2.53.0/remote.c:1985:23: branch_true: ...to here
git-2.53.0/remote.c:1987:17: call_function: calling ‘strbuf_setlen’ from ‘get_expanded_map’
git-2.53.0/remote.c:1987:17: return_function: returning to ‘get_expanded_map’ from ‘strbuf_setlen’
git-2.53.0/remote.c:1989:20: branch_false: following ‘false’ branch...
git-2.53.0/remote.c:1992:45: branch_false: ...to here
git-2.53.0/remote.c:1991:21: branch_true: following ‘true’ branch...
git-2.53.0/remote.c:1994:43: branch_true: ...to here
git-2.53.0/remote.c:1994:43: call_function: calling ‘copy_ref’ from ‘get_expanded_map’
git-2.53.0/remote.c:1994:43: return_function: returning to ‘get_expanded_map’ from ‘copy_ref’
git-2.53.0/remote.c:1996:29: danger: dereference of NULL ‘copy_ref(ref)’
# 1994| struct ref *cpy = copy_ref(ref);
# 1995|
# 1996|-> if (cpy->peer_ref)
# 1997| free_one_ref(cpy->peer_ref);
# 1998| cpy->peer_ref = alloc_ref(expn_name);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/revision.c: scope_hint: In function ‘handle_dotdot’
git-2.53.0/revision.c:2134:24: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 2134 | char *dotdot = strstr(arg, "..");
# | ^~~~~~
# 2132| {
# 2133| struct object_context a_oc = {0}, b_oc = {0};
# 2134|-> char *dotdot = strstr(arg, "..");
# 2135| int ret;
# 2136|
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/revision.c:2134:24: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 2132| {
# 2133| struct object_context a_oc = {0}, b_oc = {0};
# 2134|-> char *dotdot = strstr(arg, "..");
# 2135| int ret;
# 2136|
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/revision.c: scope_hint: In function ‘handle_revision_arg_1’
git-2.53.0/revision.c:2178:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2178 | mark = strstr(arg, "^@");
# | ^
# 2176| }
# 2177|
# 2178|-> mark = strstr(arg, "^@");
# 2179| if (mark && !mark[2]) {
# 2180| *mark = 0;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/revision.c:2178:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2176| }
# 2177|
# 2178|-> mark = strstr(arg, "^@");
# 2179| if (mark && !mark[2]) {
# 2180| *mark = 0;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/revision.c:2187:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2187 | mark = strstr(arg, "^!");
# | ^
# 2185| *mark = '^';
# 2186| }
# 2187|-> mark = strstr(arg, "^!");
# 2188| if (mark && !mark[2]) {
# 2189| *mark = 0;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/revision.c:2187:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2185| *mark = '^';
# 2186| }
# 2187|-> mark = strstr(arg, "^!");
# 2188| if (mark && !mark[2]) {
# 2189| *mark = 0;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/revision.c:2193:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2193 | mark = strstr(arg, "^-");
# | ^
# 2191| *mark = '^';
# 2192| }
# 2193|-> mark = strstr(arg, "^-");
# 2194| if (mark) {
# 2195| int exclude_parent = 1;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/revision.c:2193:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2191| *mark = '^';
# 2192| }
# 2193|-> mark = strstr(arg, "^-");
# 2194| if (mark) {
# 2195| int exclude_parent = 1;
Error: GCC_ANALYZER_WARNING (CWE-775):
git-2.53.0/run-command.c:343:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fd, to)’
git-2.53.0/run-command.c:1862:22: enter_function: entry to ‘start_bg_command’
git-2.53.0/run-command.c:1879:12: branch_false: following ‘false’ branch...
git-2.53.0/run-command.c:1882:14: branch_false: ...to here
git-2.53.0/run-command.c:1885:15: call_function: calling ‘start_command’ from ‘start_bg_command’
# 341| static void child_dup2(int fd, int to)
# 342| {
# 343|-> if (dup2(fd, to) < 0)
# 344| child_die(CHILD_ERR_DUP2);
# 345| }
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/run-command.c: scope_hint: In function ‘trace_add_env’
git-2.53.0/run-command.c:608:32: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 608 | char *equals = strchr(*e, '=');
# | ^~~~~~
# 606| for (e = deltaenv; e && *e; e++) {
# 607| struct strbuf key = STRBUF_INIT;
# 608|-> char *equals = strchr(*e, '=');
# 609|
# 610| if (equals) {
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/run-command.c:608:32: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 606| for (e = deltaenv; e && *e; e++) {
# 607| struct strbuf key = STRBUF_INIT;
# 608|-> char *equals = strchr(*e, '=');
# 609|
# 610| if (equals) {
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/send-pack.c: scope_hint: In function ‘receive_status’
git-2.53.0/send-pack.c:184:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 184 | p = strchr(head, ' ');
# | ^
# 182| break;
# 183| head = reader->line;
# 184|-> p = strchr(head, ' ');
# 185| if (!p) {
# 186| error("invalid status line from remote: %s", reader->line);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/send-pack.c:184:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 182| break;
# 183| head = reader->line;
# 184|-> p = strchr(head, ' ');
# 185| if (!p) {
# 186| error("invalid status line from remote: %s", reader->line);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/send-pack.c:215:27: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 215 | p = strchr(key, ' ');
# | ^
# 213| }
# 214| key = p;
# 215|-> p = strchr(key, ' ');
# 216| if (p)
# 217| *p++ = '\0';
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/send-pack.c:215:27: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 213| }
# 214| key = p;
# 215|-> p = strchr(key, ' ');
# 216| if (p)
# 217| *p++ = '\0';
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/send-pack.c:240:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 240 | p = strchr(refname, ' ');
# | ^
# 238| }
# 239| refname = p;
# 240|-> p = strchr(refname, ' ');
# 241| if (p)
# 242| *p++ = '\0';
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/send-pack.c:240:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 238| }
# 239| refname = p;
# 240|-> p = strchr(refname, ' ');
# 241| if (p)
# 242| *p++ = '\0';
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/strbuf.c:116:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
git-2.53.0/strbuf.c:1085:6: enter_function: entry to ‘strbuf_stripspace’
git-2.53.0/strbuf.c:1092:9: call_function: calling ‘strbuf_grow’ from ‘strbuf_stripspace’
# 114| ALLOC_GROW(sb->buf, sb->len + extra + 1, sb->alloc);
# 115| if (new_buf)
# 116|-> sb->buf[0] = '\0';
# 117| }
# 118|
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/string-list.c: scope_hint: In function ‘split_string’
git-2.53.0/string-list.c:341:29: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 341 | end = strpbrk(p, delim);
# | ^
# 339| end = NULL;
# 340| else
# 341|-> end = strpbrk(p, delim);
# 342|
# 343| count += append_one(list, p, end, in_place, flags);
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/string-list.c:341:29: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 339| end = NULL;
# 340| else
# 341|-> end = strpbrk(p, delim);
# 342|
# 343| count += append_one(list, p, end, in_place, flags);
Error: GCC_ANALYZER_WARNING (CWE-457):
git-2.53.0/t/helper/test-pack-deltas.c:69:27: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘delta_size’
git-2.53.0/t/helper/test-pack-deltas.c:46:13: enter_function: entry to ‘write_ref_delta’
git-2.53.0/t/helper/test-pack-deltas.c:57:12: branch_false: following ‘false’ branch...
git-2.53.0/t/helper/test-pack-deltas.c:60:50: branch_false: ...to here
git-2.53.0/t/helper/test-pack-deltas.c:63:12: branch_false: following ‘false’ branch...
git-2.53.0/t/helper/test-pack-deltas.c:66:21: branch_false: ...to here
git-2.53.0/t/helper/test-pack-deltas.c:66:21: call_function: calling ‘diff_delta’ from ‘write_ref_delta’
git-2.53.0/t/helper/test-pack-deltas.c:66:21: return_function: returning to ‘write_ref_delta’ from ‘diff_delta’
git-2.53.0/t/helper/test-pack-deltas.c:69:27: danger: use of uninitialized value ‘delta_size’ here
# 67| buf, size, &delta_size, 0);
# 68|
# 69|-> compressed_size = do_compress(&delta_buf, delta_size);
# 70|
# 71| hdrlen = encode_in_pack_object_header(header, sizeof(header),
Error: CPPCHECK_WARNING (CWE-664):
git-2.53.0/t/unit-tests/clar/clar.c:744: error[va_list_usedBeforeStarted]: va_list 'args_copy' used before va_start() was called.
# 742| int len;
# 743|
# 744|-> va_copy(args_copy, args);
# 745| if ((len = p_vsnprintf(NULL, 0, description, args_copy)) < 0)
# 746| clar_abort("Failed to compute description.");
Error: CPPCHECK_WARNING (CWE-664):
git-2.53.0/t/unit-tests/clar/clar.c:745: error[va_list_usedBeforeStarted]: va_list 'args_copy' used before va_start() was called.
# 743|
# 744| va_copy(args_copy, args);
# 745|-> if ((len = p_vsnprintf(NULL, 0, description, args_copy)) < 0)
# 746| clar_abort("Failed to compute description.");
# 747| va_end(args_copy);
Error: CPPCHECK_WARNING (CWE-664):
git-2.53.0/t/unit-tests/clar/clar.c:747: error[va_list_usedBeforeStarted]: va_list 'args_copy' used before va_start() was called.
# 745| if ((len = p_vsnprintf(NULL, 0, description, args_copy)) < 0)
# 746| clar_abort("Failed to compute description.");
# 747|-> va_end(args_copy);
# 748|
# 749| if ((error->description = calloc(1, len + 1)) == NULL)
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/t/unit-tests/clar/clar.c:1054: included_from: Included from here.
git-2.53.0/t/unit-tests/clar/clar/print.h: scope_hint: In function ‘print_escaped’
git-2.53.0/t/unit-tests/clar/clar/print.h:132:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 132 | while ((c = strchr(str, '\'')) != NULL) {
# | ^
# 130| char *c;
# 131|
# 132|-> while ((c = strchr(str, '\'')) != NULL) {
# 133| printf("%.*s", (int)(c - str), str);
# 134| printf("''");
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/t/unit-tests/clar/clar/print.h:132:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 130| char *c;
# 131|
# 132|-> while ((c = strchr(str, '\'')) != NULL) {
# 133| printf("%.*s", (int)(c - str), str);
# 134| printf("''");
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/t/unit-tests/u-reftable-basics.c:200:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
git-2.53.0/t/unit-tests/u-reftable-basics.c:192:6: enter_function: entry to ‘test_reftable_basics__alloc_grow’
git-2.53.0/t/unit-tests/u-reftable-basics.c:197:9: call_function: calling ‘reftable_alloc_grow’ from ‘test_reftable_basics__alloc_grow’
git-2.53.0/t/unit-tests/u-reftable-basics.c:197:9: return_function: returning to ‘test_reftable_basics__alloc_grow’ from ‘reftable_alloc_grow’
git-2.53.0/t/unit-tests/u-reftable-basics.c:197:9: branch_true: following ‘true’ branch...
git-2.53.0/t/unit-tests/u-reftable-basics.c:197:9: branch_true: ...to here
git-2.53.0/t/unit-tests/u-reftable-basics.c:200:9: danger: dereference of NULL ‘reftable_alloc_grow(0, 1, 4, &alloc)’
# 198| cl_assert(arr != NULL);
# 199| cl_assert(alloc >= 1);
# 200|-> arr[0] = 42;
# 201|
# 202| old_alloc = alloc;
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/t/unit-tests/u-reftable-basics.c:227:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘arr’
git-2.53.0/t/unit-tests/u-reftable-basics.c:219:6: enter_function: entry to ‘test_reftable_basics__alloc_grow_or_null’
git-2.53.0/t/unit-tests/u-reftable-basics.c:224:9: call_function: calling ‘reftable_alloc_grow’ from ‘test_reftable_basics__alloc_grow_or_null’
git-2.53.0/t/unit-tests/u-reftable-basics.c:224:9: return_function: returning to ‘test_reftable_basics__alloc_grow_or_null’ from ‘reftable_alloc_grow’
git-2.53.0/t/unit-tests/u-reftable-basics.c:224:9: branch_true: following ‘true’ branch...
git-2.53.0/t/unit-tests/u-reftable-basics.c:224:9: branch_true: ...to here
git-2.53.0/t/unit-tests/u-reftable-basics.c:227:9: danger: dereference of NULL ‘arr’
# 225| cl_assert(arr != NULL);
# 226| cl_assert(alloc >= 1);
# 227|-> arr[0] = 42;
# 228|
# 229| old_alloc = alloc;
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/t/unit-tests/u-reftable-merged.c:183:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘out’
git-2.53.0/t/unit-tests/u-reftable-merged.c:105:6: enter_function: entry to ‘test_reftable_merged__refs’
git-2.53.0/t/unit-tests/u-reftable-merged.c:160:17: call_function: calling ‘merged_table_from_records’ from ‘test_reftable_merged__refs’
git-2.53.0/t/unit-tests/u-reftable-merged.c:160:17: return_function: returning to ‘test_reftable_merged__refs’ from ‘merged_table_from_records’
git-2.53.0/t/unit-tests/u-reftable-merged.c:176:16: branch_true: following ‘true’ branch (when ‘len != 100’)...
git-2.53.0/t/unit-tests/u-reftable-merged.c:177:44: branch_true: ...to here
git-2.53.0/t/unit-tests/u-reftable-merged.c:179:20: branch_false: following ‘false’ branch...
git-2.53.0/t/unit-tests/u-reftable-merged.c:182:17: branch_false: ...to here
git-2.53.0/t/unit-tests/u-reftable-merged.c:182:17: branch_true: following ‘true’ branch...
git-2.53.0/t/unit-tests/u-reftable-merged.c:182:17: branch_true: ...to here
git-2.53.0/t/unit-tests/u-reftable-merged.c:182:17: call_function: calling ‘reftable_alloc_grow’ from ‘test_reftable_merged__refs’
git-2.53.0/t/unit-tests/u-reftable-merged.c:182:17: return_function: returning to ‘test_reftable_merged__refs’ from ‘reftable_alloc_grow’
git-2.53.0/t/unit-tests/u-reftable-merged.c:182:17: branch_true: following ‘true’ branch...
git-2.53.0/t/unit-tests/u-reftable-merged.c:182:17: branch_true: ...to here
git-2.53.0/t/unit-tests/u-reftable-merged.c:183:17: danger: dereference of NULL ‘out + len * 96’
# 181|
# 182| cl_assert(REFTABLE_ALLOC_GROW(out, len + 1, cap) == 0);
# 183|-> out[len++] = ref;
# 184| }
# 185| reftable_iterator_destroy(&it);
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/t/unit-tests/u-reftable-merged.c:456:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘out’
git-2.53.0/t/unit-tests/u-reftable-merged.c:373:6: enter_function: entry to ‘test_reftable_merged__logs’
git-2.53.0/t/unit-tests/u-reftable-merged.c:432:44: call_function: calling ‘merged_table_from_log_records’ from ‘test_reftable_merged__logs’
git-2.53.0/t/unit-tests/u-reftable-merged.c:432:44: return_function: returning to ‘test_reftable_merged__logs’ from ‘merged_table_from_log_records’
git-2.53.0/t/unit-tests/u-reftable-merged.c:449:16: branch_true: following ‘true’ branch (when ‘len != 100’)...
git-2.53.0/t/unit-tests/u-reftable-merged.c:450:44: branch_true: ...to here
git-2.53.0/t/unit-tests/u-reftable-merged.c:452:20: branch_false: following ‘false’ branch...
git-2.53.0/t/unit-tests/u-reftable-merged.c:455:17: branch_false: ...to here
git-2.53.0/t/unit-tests/u-reftable-merged.c:455:17: branch_true: following ‘true’ branch...
git-2.53.0/t/unit-tests/u-reftable-merged.c:455:17: branch_true: ...to here
git-2.53.0/t/unit-tests/u-reftable-merged.c:455:17: call_function: calling ‘reftable_alloc_grow’ from ‘test_reftable_merged__logs’
git-2.53.0/t/unit-tests/u-reftable-merged.c:455:17: return_function: returning to ‘test_reftable_merged__logs’ from ‘reftable_alloc_grow’
git-2.53.0/t/unit-tests/u-reftable-merged.c:455:17: branch_true: following ‘true’ branch...
git-2.53.0/t/unit-tests/u-reftable-merged.c:455:17: branch_true: ...to here
git-2.53.0/t/unit-tests/u-reftable-merged.c:456:17: danger: dereference of NULL ‘out + len * 144’
# 454|
# 455| cl_assert(REFTABLE_ALLOC_GROW(out, len + 1, cap) == 0);
# 456|-> out[len++] = log;
# 457| }
# 458| reftable_iterator_destroy(&it);
Error: GCC_ANALYZER_WARNING (CWE-401):
git-2.53.0/tempfile.c:273:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fdopen(*tempfile.fd, mode)’
git-2.53.0/tempfile.c:268:12: branch_false: following ‘false’ branch (when ‘tempfile’ is non-NULL)...
git-2.53.0/tempfile.c:270:13: branch_false: ...to here
git-2.53.0/tempfile.c:270:12: branch_false: following ‘false’ branch...
git-2.53.0/tempfile.c:273:31: branch_false: ...to here
git-2.53.0/tempfile.c:273:24: acquire_memory: allocated here
git-2.53.0/tempfile.c:273:9: danger: ‘fdopen(*tempfile.fd, mode)’ leaks here; was allocated at [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
# 271| BUG("fdopen_tempfile() called for open object");
# 272|
# 273|-> tempfile->fp = fdopen(tempfile->fd, mode);
# 274| return tempfile->fp;
# 275| }
Error: GCC_ANALYZER_WARNING (CWE-775):
git-2.53.0/tempfile.c:332:9: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(*tempfile.filename.buf, 513)’
git-2.53.0/tempfile.c:328:12: branch_false: following ‘false’ branch (when ‘tempfile’ is non-NULL)...
git-2.53.0/tempfile.c:330:18: branch_false: ...to here
git-2.53.0/tempfile.c:330:12: branch_false: following ‘false’ branch...
git-2.53.0/tempfile.c:332:29: branch_false: ...to here
git-2.53.0/tempfile.c:332:24: acquire_resource: opened here
git-2.53.0/tempfile.c:332:9: danger: ‘open(*tempfile.filename.buf, 513)’ leaks here; was opened at [(5)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/4)
# 330| if (0 <= tempfile->fd)
# 331| BUG("reopen_tempfile called for an open object");
# 332|-> tempfile->fd = open(tempfile->filename.buf, O_WRONLY|O_TRUNC);
# 333| return tempfile->fd;
# 334| }
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/transport-helper.c: scope_hint: In function ‘push_update_ref_status’
git-2.53.0/transport-helper.c:803:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 803 | p = strchr(key, ' ');
# | ^
# 801| }
# 802| key = buf->buf + 7;
# 803|-> p = strchr(key, ' ');
# 804| if (p)
# 805| *p++ = '\0';
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/transport-helper.c:803:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 801| }
# 802| key = buf->buf + 7;
# 803|-> p = strchr(key, ' ');
# 804| if (p)
# 805| *p++ = '\0';
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/transport.c: scope_hint: In function ‘transport_anonymize_url’
git-2.53.0/transport.c:1663:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1663 | anon_part = strchr(url, '@');
# | ^
# 1661| size_t anon_len, prefix_len = 0;
# 1662|
# 1663|-> anon_part = strchr(url, '@');
# 1664| if (url_is_local_not_ssh(url) || !anon_part)
# 1665| goto literal_copy;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/transport.c:1663:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1661| size_t anon_len, prefix_len = 0;
# 1662|
# 1663|-> anon_part = strchr(url, '@');
# 1664| if (url_is_local_not_ssh(url) || !anon_part)
# 1665| goto literal_copy;
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/transport.c:1668:23: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1668 | scheme_prefix = strstr(url, "://");
# | ^
# 1666|
# 1667| anon_len = strlen(++anon_part);
# 1668|-> scheme_prefix = strstr(url, "://");
# 1669| if (!scheme_prefix) {
# 1670| if (!strchr(anon_part, ':'))
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/transport.c:1668:23: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1666|
# 1667| anon_len = strlen(++anon_part);
# 1668|-> scheme_prefix = strstr(url, "://");
# 1669| if (!scheme_prefix) {
# 1670| if (!strchr(anon_part, ':'))
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/unpack-trees.c:2332:13: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ce’
git-2.53.0/unpack-trees.c:2475:12: enter_function: entry to ‘verify_absent_1’
git-2.53.0/unpack-trees.c:2486:12: branch_false: following ‘false’ branch...
git-2.53.0/unpack-trees.c:2496:44: branch_false: ...to here
git-2.53.0/unpack-trees.c:2497:12: branch_false: following ‘false’ branch...
git-2.53.0/unpack-trees.c:2499:17: branch_false: ...to here
git-2.53.0/unpack-trees.c:2499:17: branch_true: following ‘true’ branch...
git-2.53.0/unpack-trees.c:2503:24: branch_true: ...to here
git-2.53.0/unpack-trees.c:2504:20: branch_false: following ‘false’ branch...
git-2.53.0/unpack-trees.c:2507:29: branch_false: ...to here
git-2.53.0/unpack-trees.c:2507:28: branch_false: following ‘false’ branch...
git-2.53.0/unpack-trees.c:2512:39: branch_false: ...to here
git-2.53.0/unpack-trees.c:2512:39: call_function: calling ‘check_ok_to_remove’ from ‘verify_absent_1’
# 2330| int cnt = 0;
# 2331|
# 2332|-> if (S_ISGITLINK(ce->ce_mode)) {
# 2333| struct object_id oid;
# 2334| int sub_head = repo_resolve_gitlink_ref(the_repository, ce->name,
Error: GCC_ANALYZER_WARNING (CWE-476):
git-2.53.0/utf8.c:137:20: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘s’
git-2.53.0/utf8.c:804:5: enter_function: entry to ‘is_hfs_dotmailmap’
git-2.53.0/utf8.c:806:16: call_function: calling ‘is_hfs_dot_str’ from ‘is_hfs_dotmailmap’
# 135| if (remainder < 1) {
# 136| goto invalid;
# 137|-> } else if (*s < 0x80) {
# 138| /* 0xxxxxxx */
# 139| ch = *s;
Error: GCC_ANALYZER_WARNING (CWE-688):
git-2.53.0/utf8.h:46:16: warning[-Wanalyzer-null-argument]: use of NULL ‘in’ where non-null expected
git-2.53.0/builtin/fast-export.c:1313:5: enter_function: entry to ‘cmd_fast_export’
git-2.53.0/builtin/fast-export.c:1372:12: branch_false: following ‘false’ branch (when ‘argc != 1’)...
git-2.53.0/builtin/fast-export.c:1376:9: branch_false: ...to here
git-2.53.0/builtin/fast-export.c:1386:12: branch_false: following ‘false’ branch...
git-2.53.0/builtin/fast-export.c:1389:13: branch_false: ...to here
git-2.53.0/builtin/fast-export.c:1404:13: branch_false: following ‘false’ branch...
git-2.53.0/builtin/fast-export.c:1406:12: branch_false: ...to here
git-2.53.0/builtin/fast-export.c:1407:17: call_function: calling ‘import_marks’ from ‘cmd_fast_export’
git-2.53.0/builtin/fast-export.c:1407:17: return_function: returning to ‘cmd_fast_export’ from ‘import_marks’
git-2.53.0/builtin/fast-export.c:1417:12: branch_false: following ‘false’ branch...
git-2.53.0/builtin/fast-export.c:1420:9: branch_false: ...to here
git-2.53.0/builtin/fast-export.c:1426:16: branch_true: following ‘true’ branch...
git-2.53.0/builtin/fast-export.c:1427:17: branch_true: ...to here
git-2.53.0/builtin/fast-export.c:1427:17: call_function: calling ‘handle_commit’ from ‘cmd_fast_export’
# 44| const char *in_encoding)
# 45| {
# 46|-> return reencode_string_len(in, strlen(in),
# 47| out_encoding, in_encoding,
# 48| NULL);
Error: GCC_ANALYZER_WARNING (CWE-775):
git-2.53.0/worktree.c:948:23: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(gitdir.buf, 0)’
git-2.53.0/worktree.c:927:12: branch_false: following ‘false’ branch...
git-2.53.0/worktree.c:932:9: branch_false: ...to here
git-2.53.0/worktree.c:933:12: branch_false: following ‘false’ branch...
git-2.53.0/worktree.c:936:18: branch_false: ...to here
git-2.53.0/worktree.c:936:12: branch_false: following ‘false’ branch...
git-2.53.0/worktree.c:941:19: branch_false: ...to here
git-2.53.0/worktree.c:941:14: acquire_resource: opened here
git-2.53.0/worktree.c:942:12: branch_false: following ‘false’ branch...
git-2.53.0/worktree.c:948:23: branch_false: ...to here
git-2.53.0/worktree.c:948:23: danger: ‘open(gitdir.buf, 0)’ leaks here; was opened at [(7)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/6)
# 946| goto done;
# 947| }
# 948|-> len = xsize_t(st.st_size);
# 949| path = xmallocz(len);
# 950|
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/wrapper.c: scope_hint: In function ‘xstrndup’
git-2.53.0/wrapper.c:118:19: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 118 | char *p = memchr(str, '\0', len);
# | ^~~~~~
# 116| char *xstrndup(const char *str, size_t len)
# 117| {
# 118|-> char *p = memchr(str, '\0', len);
# 119| return xmemdupz(str, p ? p - str : len);
# 120| }
Error: COMPILER_WARNING (CWE-704):
git-2.53.0/wrapper.c:118:19: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 116| char *xstrndup(const char *str, size_t len)
# 117| {
# 118|-> char *p = memchr(str, '\0', len);
# 119| return xmemdupz(str, p ? p - str : len);
# 120| }