<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -214,8 +214,11 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
 		num_attr = 0;
 		cp = name + namelen;
 		cp = cp + strspn(cp, blank);
-		while (*cp)
+		while (*cp) {
 			cp = parse_attr(src, lineno, cp, &amp;num_attr, res);
+			if (!cp)
+				return NULL;
+		}
 		if (pass)
 			break;
 		res = xcalloc(1,</diff>
      <filename>attr.c</filename>
    </modified>
    <modified>
      <diff>@@ -371,4 +371,11 @@ test_expect_success 'in-tree .gitattributes (4)' '
 	}
 '
 
+test_expect_success 'invalid .gitattributes (must not crash)' '
+
+	echo &quot;three +crlf&quot; &gt;&gt;.gitattributes &amp;&amp;
+	git diff
+
+'
+
 test_done</diff>
      <filename>t/t0020-crlf.sh</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>415e7b877c54440bf92137a7021416efdf0a29b5</id>
    </parent>
  </parents>
  <author>
    <name>Steffen Prohaska</name>
    <email>prohaska@zib.de</email>
  </author>
  <url>http://github.com/schacon/git-source/commit/d7b0a09316fe8dcb62ad247dbbb45c3c777667ad</url>
  <id>d7b0a09316fe8dcb62ad247dbbb45c3c777667ad</id>
  <committed-date>2007-10-18T18:11:27-07:00</committed-date>
  <authored-date>2007-10-18T13:02:35-07:00</authored-date>
  <message>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 &lt;prohaska@zib.de&gt;
Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;</message>
  <tree>a502781dd4cb2d46d3e4937263e61866ada2f66d</tree>
  <committer>
    <name>Shawn O. Pearce</name>
    <email>spearce@spearce.org</email>
  </committer>
</commit>
