summaryrefslogtreecommitdiff
path: root/builtin-blame.c
diff options
context:
space:
mode:
authorJay Soffian <jaysoffian@gmail.com>2010-02-09 03:48:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-02-09 05:52:44 (GMT)
commit92f9e273e86d505e4c2a28bc053eb514ca2cc552 (patch)
tree91170fd1acacb90306c8acb2f87f4750c877f217 /builtin-blame.c
parent153559a964f436aeb909e3b7e86ceaa998aeed68 (diff)
downloadgit-92f9e273e86d505e4c2a28bc053eb514ca2cc552.zip
git-92f9e273e86d505e4c2a28bc053eb514ca2cc552.tar.gz
git-92f9e273e86d505e4c2a28bc053eb514ca2cc552.tar.bz2
blame: prevent a segv when -L given start > EOF
blame would segv if given -L <lineno> with <lineno> past the end of the file. While we're fixing the bug, add test cases for an invalid <start> when called as -L <start>,<end> or -L<start>. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-blame.c')
-rw-r--r--builtin-blame.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin-blame.c b/builtin-blame.c
index 98e818c..4094f3c 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -2432,7 +2432,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));