diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-02-08 21:53:54 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-02-08 21:53:54 -0800 |
commit | e33cc592deae8132936eea119554799e1039bc0f (patch) | |
tree | de03ec4e298bf23e73f7789a4f00cad2385ff756 | |
parent | Merge branch 'jc/maint-push-doc-status' into maint (diff) | |
parent | blame: prevent a segv when -L given start > EOF (diff) | |
download | tgif-e33cc592deae8132936eea119554799e1039bc0f.tar.xz |
Merge branch 'maint-1.6.5' into maint
* maint-1.6.5:
blame: prevent a segv when -L given start > EOF
-rw-r--r-- | builtin-blame.c | 2 | ||||
-rwxr-xr-x | t/t8003-blame.sh | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/builtin-blame.c b/builtin-blame.c index 6408ec8ee6..10f7eacf6e 100644 --- a/builtin-blame.c +++ b/builtin-blame.c @@ -2433,7 +2433,7 @@ parse_done: if (top < 1) top = lno; bottom--; - if (lno < top) + if (lno < top || lno < bottom) die("file %s has only %lu lines", path, lno); ent = xcalloc(1, sizeof(*ent)); diff --git a/t/t8003-blame.sh b/t/t8003-blame.sh index ad834f200a..4a8db74f7e 100755 --- a/t/t8003-blame.sh +++ b/t/t8003-blame.sh @@ -157,4 +157,12 @@ EOF git --no-pager blame $COMMIT -- uno >/dev/null ' +test_expect_success 'blame -L with invalid start' ' + test_must_fail git blame -L5 tres 2>&1 | grep "has only 2 lines" +' + +test_expect_success 'blame -L with invalid end' ' + git blame -L1,5 tres 2>&1 | grep "has only 2 lines" +' + test_done |