git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] fix git-gui crash due to uninitialized variable

From
Clemens Buchacher <drizzd@aon.at>
Date
Jan 21, 2012, 17:57 UTC
Message-ID
<20120121175724.GA7319@ecki>

Recently, a clone initiated via git gui on Windows crashed on me due to an "unknown variable cdone". It turns out that there is a code path where this variable is used uninitialized.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
---

Looking at the output of display(), it's not clear to me now the function below could ever be called with total=0. But I can't delve into it more deeply right now, and this seems like an obvious fix.

 git-gui/lib/status_bar.tcl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/git-gui/lib/status_bar.tcl b/git-gui/lib/status_bar.tcl
index 95cb449..02111a1 100644
--- a/git-gui/lib/status_bar.tcl
+++ b/git-gui/lib/status_bar.tcl
@@ -77,6 +77,7 @@ method start {msg uds} {
 
 method update {have total} {
 	set pdone 0
+	set cdone 0
 	if {$total > 0} {
 		set pdone [expr {100 * $have / $total}]
 		set cdone [expr {[winfo width $w_c] * $have / $total}]
-- 
1.7.8
Next: Junio C Hamano
Message 1 of 3 in “fix git-gui crash due to uninitialized variable”
  1. fix git-gui crash due to uninitialized variableClemens Buchacher, Jan 21, 2012
  2. Junio C HamanoJan 21, 2012
  3. Pat ThoytsJan 22, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.