From 77e8466fb98b95ea07d386d64073d0bc6304b37f Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Sun, 28 Feb 2010 16:49:15 +0100 Subject: [PATCH 1/3] sha1_name: fix segfault caused by invalid index access The code to see if user input "git show :path" makes sense tried to access the index without properly checking the array bound. Signed-off-by: Markus Heidelberg Signed-off-by: Junio C Hamano --- sha1_name.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/sha1_name.c b/sha1_name.c index 43884c69b3..bf92417838 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -992,13 +992,15 @@ static void diagnose_invalid_index_path(int stage, pos = cache_name_pos(filename, namelen); if (pos < 0) pos = -pos - 1; - ce = active_cache[pos]; - if (ce_namelen(ce) == namelen && - !memcmp(ce->name, filename, namelen)) - die("Path '%s' is in the index, but not at stage %d.\n" - "Did you mean ':%d:%s'?", - filename, stage, - ce_stage(ce), filename); + if (pos < active_nr) { + ce = active_cache[pos]; + if (ce_namelen(ce) == namelen && + !memcmp(ce->name, filename, namelen)) + die("Path '%s' is in the index, but not at stage %d.\n" + "Did you mean ':%d:%s'?", + filename, stage, + ce_stage(ce), filename); + } /* Confusion between relative and absolute filenames? */ fullnamelen = namelen + strlen(prefix); @@ -1008,13 +1010,15 @@ static void diagnose_invalid_index_path(int stage, pos = cache_name_pos(fullname, fullnamelen); if (pos < 0) pos = -pos - 1; - ce = active_cache[pos]; - if (ce_namelen(ce) == fullnamelen && - !memcmp(ce->name, fullname, fullnamelen)) - die("Path '%s' is in the index, but not '%s'.\n" - "Did you mean ':%d:%s'?", - fullname, filename, - ce_stage(ce), fullname); + if (pos < active_nr) { + ce = active_cache[pos]; + if (ce_namelen(ce) == fullnamelen && + !memcmp(ce->name, fullname, fullnamelen)) + die("Path '%s' is in the index, but not '%s'.\n" + "Did you mean ':%d:%s'?", + fullname, filename, + ce_stage(ce), fullname); + } if (!lstat(filename, &st)) die("Path '%s' exists on disk, but not in the index.", filename); From c0d3a38293530c1e2ff873553fabe6dc4694aaaf Mon Sep 17 00:00:00 2001 From: Mark Lodato Date: Fri, 26 Feb 2010 23:57:48 -0500 Subject: [PATCH 2/3] Remove reference to GREP_COLORS from documentation There is no longer support for external grep, as per bbc09c2 (grep: rip out support for external grep, 2010-01-12), so remove the reference to it from the documentation. Signed-off-by: Mark Lodato Signed-off-by: Junio C Hamano --- Documentation/config.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 4c36aa95b7..2dc3a0583b 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -680,9 +680,7 @@ color.grep:: color.grep.match:: Use customized color for matches. The value of this variable - may be specified as in color.branch.. It is passed using - the environment variables 'GREP_COLOR' and 'GREP_COLORS' when - calling an external 'grep'. + may be specified as in color.branch.. color.interactive:: When set to `always`, always use colors for interactive prompts From c5e5f6030573b5433284b4e6b4342ab7204f20e1 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 28 Feb 2010 11:41:24 -0800 Subject: [PATCH 3/3] Git 1.7.0.1 Signed-off-by: Junio C Hamano --- Documentation/RelNotes-1.7.0.1.txt | 14 +++++++++----- Documentation/git.txt | 3 ++- GIT-VERSION-GEN | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Documentation/RelNotes-1.7.0.1.txt b/Documentation/RelNotes-1.7.0.1.txt index 970cd59330..8ff5bcada8 100644 --- a/Documentation/RelNotes-1.7.0.1.txt +++ b/Documentation/RelNotes-1.7.0.1.txt @@ -7,9 +7,17 @@ Fixes since v1.7.0 * In a freshly created repository "rev-parse HEAD^0" complained that it is dangling symref, even though "rev-parse HEAD" didn't. + * "git show :no-such-name" tried to access the index without bounds + check, leading to a potential segfault. + * Message from "git cherry-pick" was harder to read and use than necessary when it stopped due to conflicting changes. + * We referred to ".git/refs/" throughout the documentation when we + meant to talk about abstract notion of "ref namespace". Because + people's repositories often have packed refs these days, this was + confusing. + * "git diff --output=/path/that/cannot/be/written" did not correctly error out. @@ -24,8 +32,4 @@ Fixes since v1.7.0 option was propagated to "git stash drop" that is internally run at the end. --- -exec >/var/tmp/1 -echo O=$(git describe) -O=v1.7.0-22-gc69f921 -git shortlog $O.. +And other minor fixes and documentation updates. diff --git a/Documentation/git.txt b/Documentation/git.txt index 01c463101b..cc32ce18d2 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -43,9 +43,10 @@ unreleased) version of git, that is available from 'master' branch of the `git.git` repository. Documentation for older releases are available here: -* link:v1.7.0/git.html[documentation for release 1.7.0] +* link:v1.7.0.1/git.html[documentation for release 1.7.0.1] * release notes for + link:RelNotes-1.7.0.1.txt[1.7.0.1], link:RelNotes-1.7.0.txt[1.7.0]. * link:v1.6.6.2/git.html[documentation for release 1.6.6.2] diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index a668143d7a..7f894fdd46 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v1.7.0.GIT +DEF_VER=v1.7.0.1 LF=' '