{"thread":{"id":"18375","subject":"[PATCH] git log: avoid segfault with --all-match","startedAt":"2009-03-18T18:06:16Z","lastAt":"2009-03-18T20:53:27Z","messageCount":3,"participants":["Michele Ballabio","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"108395","messageId":"1237399576-27323-1-git-send-email-barra_cuda@katamail.com","threadId":"18375","inReplyTo":null,"subject":"[PATCH] git log: avoid segfault with --all-match","fromName":"Michele Ballabio","fromEmail":"barra_cuda@katamail.com","sentAt":"2009-03-18T18:06:16Z","receivedAt":"2009-03-18T18:06:16Z","isPatch":true,"sender":{"key":"barra_cuda@katamail.com","avatar":"https://avatars.githubusercontent.com/u/16371673?v=4"},"body":"Avoid a segfault when the command\n\n\tgit log --all-match\n\nwas issued.\n\nSigned-off-by: Michele Ballabio <barra_cuda@katamail.com>\n---\n\nNot sure if this is the right fix, nor if it would be better a\nwarning or an error.\n\n grep.c |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/grep.c b/grep.c\nindex 062b2b6..cb4666d 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -190,7 +190,8 @@ void compile_grep_patterns(struct grep_opt *opt)\n \t * A classic recursive descent parser would do.\n \t */\n \tp = opt->pattern_list;\n-\topt->pattern_expression = compile_pattern_expr(&p);\n+\tif (p)\n+\t\topt->pattern_expression = compile_pattern_expr(&p);\n \tif (p)\n \t\tdie(\"incomplete pattern expression: %s\", p->pattern);\n }\n-- \n1.6.2.22.gc2ac\n"},{"id":"108404","messageId":"7vbpryfzpb.fsf@gitster.siamese.dyndns.org","threadId":"18375","inReplyTo":"1237399576-27323-1-git-send-email-barra_cuda@katamail.com","subject":"Re: [PATCH] git log: avoid segfault with --all-match","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-18T18:33:36Z","receivedAt":"2009-03-18T18:33:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michele Ballabio <barra_cuda@katamail.com> writes:\n\n> Avoid a segfault when the command\n>\n> \tgit log --all-match\n>\n> was issued.\n>\n> Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>\n> ---\n>\n> Not sure if this is the right fix, nor if it would be better a\n> warning or an error.\n\nI think ignoring it makes sense; you could alias \"git log --all-match\" to\nsomething like \"git lg\", and when no grepping option appears it will still\nwork.\n\nI'd add s/was issued./was issued, by ignoring the option/; or something\nlike that, though.\n"},{"id":"108413","messageId":"1237409607-4169-1-git-send-email-barra_cuda@katamail.com","threadId":"18375","inReplyTo":"7vbpryfzpb.fsf@gitster.siamese.dyndns.org","subject":"[PATCH v2] git log: avoid segfault with --all-match","fromName":"Michele Ballabio","fromEmail":"barra_cuda@katamail.com","sentAt":"2009-03-18T20:53:27Z","receivedAt":"2009-03-18T20:53:27Z","isPatch":true,"sender":{"key":"barra_cuda@katamail.com","avatar":"https://avatars.githubusercontent.com/u/16371673?v=4"},"body":"Avoid a segfault when the command\n\n\tgit log --all-match\n\nwas issued, by ignoring the option.\n\nSigned-off-by: Michele Ballabio <barra_cuda@katamail.com>\n---\n grep.c |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/grep.c b/grep.c\nindex 062b2b6..cb4666d 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -190,7 +190,8 @@ void compile_grep_patterns(struct grep_opt *opt)\n \t * A classic recursive descent parser would do.\n \t */\n \tp = opt->pattern_list;\n-\topt->pattern_expression = compile_pattern_expr(&p);\n+\tif (p)\n+\t\topt->pattern_expression = compile_pattern_expr(&p);\n \tif (p)\n \t\tdie(\"incomplete pattern expression: %s\", p->pattern);\n }\n-- \n1.6.2.22.gc2ac\n"}]}