summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 415e7b8)
raw | patch | inline | side by side (parent: 415e7b8)
author | Steffen Prohaska <prohaska@zib.de> | |
Thu, 18 Oct 2007 20:02:35 +0000 (22:02 +0200) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 19 Oct 2007 01:11:27 +0000 (21:11 -0400) |
git may segfault if gitattributes contains an invalid
entry. A test is added to t0020 that triggers the segfault.
The parsing code is fixed to avoid the crash.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
entry. A test is added to t0020 that triggers the segfault.
The parsing code is fixed to avoid the crash.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
attr.c | patch | blob | history | |
t/t0020-crlf.sh | patch | blob | history |
index 129399310ae061a66527ce0b723cc0aeb30ef34c..6e82507be77b1881925fda7ead8c3a5432bf6576 100644 (file)
--- a/attr.c
+++ b/attr.c
num_attr = 0;
cp = name + namelen;
cp = cp + strspn(cp, blank);
- while (*cp)
+ while (*cp) {
cp = parse_attr(src, lineno, cp, &num_attr, res);
+ if (!cp)
+ return NULL;
+ }
if (pass)
break;
res = xcalloc(1,
diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh
index 0807d9f01a178567e433c9c057064d026109ade2..62bc4bb077d06920509228b9fcd6464472e96dc2 100755 (executable)
--- a/t/t0020-crlf.sh
+++ b/t/t0020-crlf.sh
}
'
+test_expect_success 'invalid .gitattributes (must not crash)' '
+
+ echo "three +crlf" >>.gitattributes &&
+ git diff
+
+'
+
test_done