attr: fix segfault in gitattributes parsing code

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>
This commit is contained in:
Steffen Prohaska
2007-10-18 22:02:35 +02:00
committed by Shawn O. Pearce
parent 415e7b877c
commit d7b0a09316
2 changed files with 11 additions and 1 deletions

View File

@ -371,4 +371,11 @@ test_expect_success 'in-tree .gitattributes (4)' '
}
'
test_expect_success 'invalid .gitattributes (must not crash)' '
echo "three +crlf" >>.gitattributes &&
git diff
'
test_done