Hello! I'm using the next branch as of commit 6a40327d242dac9f85c6d63c94d537b45ba86e89 A segfault occurs in using the new builtin grep when using it on a binary file, so no regular \n endings. A testcase is the attached (if it survives the vger filters) "git.png" icon as it is used for example on the http://www.kernel.org/git website. I tried the obvious, this is the line that gives the segfault: diff --git a/builtin-grep.c b/builtin-grep.c index 09e3677..5d4f319 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -121,7 +121,7 @@ static void compile_patterns(struct grep static char *end_of_line(char *cp, unsigned long *left) { unsigned long l = *left; - while (l && *cp != '\n') { + while (l && *cp && *cp != '\n') { l--; cp++; } but it did not solve the problem. Unfortunately I have no time at the moment to investigate further, so just this report at the moment. On a side-note it might be handy to add the icon to the main git repository and to use it in (new) test cases for git grep. Of course grepping in binary files is mostly not very useful, but lots of real-world repo's have some binaries. -- Marco Roeland
Attachment:
git.png
Description: git.png