Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2015-10-31 20:36:35 +0300
committerJunio C Hamano <gitster@pobox.com>2015-11-01 20:58:20 +0300
commitbaf0a3e47d807b63e9fc5628caa455d1da91dd6c (patch)
treeda59ce7b46e19b24fe669c6ae26183ebb4e6a741 /t/t7060-wtstatus.sh
parentbcf8cc25acb3378bf62f2cfc27c28302585841c0 (diff)
wt-status: avoid building bogus branch name with detached HEAD
If we're on a detached HEAD then wt_shortstatus_print_tracking() takes the string "HEAD (no branch)", translates it, skips the first eleven characters and passes the result to branch_get(), which returns a bogus result and accesses memory out of bounds in order to produce it. Somehow stat_tracking_info(), which is passed that result, does the right thing anyway, i.e. it finds that there is no base. Avoid the bogus results and memory accesses by checking for HEAD first and exiting early in that case. This fixes t7060 with --valgrind. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7060-wtstatus.sh')
-rwxr-xr-xt/t7060-wtstatus.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh
index 879d0c169d..58df3f3bb1 100755
--- a/t/t7060-wtstatus.sh
+++ b/t/t7060-wtstatus.sh
@@ -213,7 +213,7 @@ EOF
git checkout master
'
-test_expect_failure 'status --branch with detached HEAD' '
+test_expect_success 'status --branch with detached HEAD' '
git reset --hard &&
git checkout master^0 &&
git status --branch --porcelain >actual &&