{"thread":{"id":"4033","subject":"segfault bug in internal git grep from next","startedAt":"2006-05-03T08:32:29Z","lastAt":"2006-05-04T08:44:18Z","messageCount":2,"participants":["Marco Roeland"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"19409","messageId":"20060503083229.GA15579@fiberbit.xs4all.nl","threadId":"4033","inReplyTo":null,"subject":"segfault bug in internal git grep from next","fromName":"Marco Roeland","fromEmail":"marco.roeland@xs4all.nl","sentAt":"2006-05-03T08:32:29Z","receivedAt":"2006-05-03T08:32:29Z","isPatch":false,"sender":{"key":"marco.roeland@xs4all.nl","avatar":null},"body":"Hello!\n\nI'm using the next branch as of commit 6a40327d242dac9f85c6d63c94d537b45ba86e89\n\nA segfault occurs in using the new builtin grep when using it on a\nbinary file, so no regular \\n endings.\n\nA testcase is the attached (if it survives the vger filters) \"git.png\"\nicon as it is used for example on the http://www.kernel.org/git website.\n\nI tried the obvious, this is the line that gives the segfault:\n\ndiff --git a/builtin-grep.c b/builtin-grep.c\nindex 09e3677..5d4f319 100644\n--- a/builtin-grep.c\n+++ b/builtin-grep.c\n@@ -121,7 +121,7 @@ static void compile_patterns(struct grep\n static char *end_of_line(char *cp, unsigned long *left)\n {\n \tunsigned long l = *left;\n-\twhile (l && *cp != '\\n') {\n+\twhile (l && *cp && *cp != '\\n') {\n \t\tl--;\n \t\tcp++;\n \t}\n\nbut it did not solve the problem. Unfortunately I have no time at the\nmoment to investigate further, so just this report at the moment.\n\nOn a side-note it might be handy to add the icon to the main git\nrepository and to use it in (new) test cases for git grep. Of course\ngrepping in binary files is mostly not very useful, but lots of\nreal-world repo's have some binaries.\n-- \nMarco Roeland\n"},{"id":"19505","messageId":"20060504084418.GA10195@fiberbit.xs4all.nl","threadId":"4033","inReplyTo":"20060503083229.GA15579@fiberbit.xs4all.nl","subject":"Re: segfault bug in internal git grep from next (fixed)","fromName":"Marco Roeland","fromEmail":"marco.roeland@xs4all.nl","sentAt":"2006-05-04T08:44:18Z","receivedAt":"2006-05-04T08:44:18Z","isPatch":false,"sender":{"key":"marco.roeland@xs4all.nl","avatar":null},"body":"On Wednesday May 3rd 2006 Marco Roeland wrote:\n\n> I'm using the next branch as of commit 6a40327d242dac9f85c6d63c94d537b45ba86e89\n> \n> A segfault occurs in using the new builtin grep when using it on a\n> binary file, so no regular \\n endings.\n\nFixed by Junio in commit 7ed36f56e33bd838d06521a37a916516397e9e8b.\n\nI really use git grep a lot. It is very powerful, and the builtin version\nmakes even more possible. Thanks very much,\n-- \nMarco Roeland\n"}]}