git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git log: avoid segfault with --all-match
@ 2009-03-18 18:06 Michele Ballabio
  2009-03-18 18:33 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Michele Ballabio @ 2009-03-18 18:06 UTC (permalink / raw)
  To: git; +Cc: gitster

Avoid a segfault when the command

	git log --all-match

was issued.

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
---

Not sure if this is the right fix, nor if it would be better a
warning or an error.

 grep.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/grep.c b/grep.c
index 062b2b6..cb4666d 100644
--- a/grep.c
+++ b/grep.c
@@ -190,7 +190,8 @@ void compile_grep_patterns(struct grep_opt *opt)
 	 * A classic recursive descent parser would do.
 	 */
 	p = opt->pattern_list;
-	opt->pattern_expression = compile_pattern_expr(&p);
+	if (p)
+		opt->pattern_expression = compile_pattern_expr(&p);
 	if (p)
 		die("incomplete pattern expression: %s", p->pattern);
 }
-- 
1.6.2.22.gc2ac

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] git log: avoid segfault with --all-match
  2009-03-18 18:06 [PATCH] git log: avoid segfault with --all-match Michele Ballabio
@ 2009-03-18 18:33 ` Junio C Hamano
  2009-03-18 20:53   ` [PATCH v2] " Michele Ballabio
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2009-03-18 18:33 UTC (permalink / raw)
  To: Michele Ballabio; +Cc: git

Michele Ballabio <barra_cuda@katamail.com> writes:

> Avoid a segfault when the command
>
> 	git log --all-match
>
> was issued.
>
> Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
> ---
>
> Not sure if this is the right fix, nor if it would be better a
> warning or an error.

I think ignoring it makes sense; you could alias "git log --all-match" to
something like "git lg", and when no grepping option appears it will still
work.

I'd add s/was issued./was issued, by ignoring the option/; or something
like that, though.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] git log: avoid segfault with --all-match
  2009-03-18 18:33 ` Junio C Hamano
@ 2009-03-18 20:53   ` Michele Ballabio
  0 siblings, 0 replies; 3+ messages in thread
From: Michele Ballabio @ 2009-03-18 20:53 UTC (permalink / raw)
  To: gitster; +Cc: git

Avoid a segfault when the command

	git log --all-match

was issued, by ignoring the option.

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
---
 grep.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/grep.c b/grep.c
index 062b2b6..cb4666d 100644
--- a/grep.c
+++ b/grep.c
@@ -190,7 +190,8 @@ void compile_grep_patterns(struct grep_opt *opt)
 	 * A classic recursive descent parser would do.
 	 */
 	p = opt->pattern_list;
-	opt->pattern_expression = compile_pattern_expr(&p);
+	if (p)
+		opt->pattern_expression = compile_pattern_expr(&p);
 	if (p)
 		die("incomplete pattern expression: %s", p->pattern);
 }
-- 
1.6.2.22.gc2ac

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-18 20:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-18 18:06 [PATCH] git log: avoid segfault with --all-match Michele Ballabio
2009-03-18 18:33 ` Junio C Hamano
2009-03-18 20:53   ` [PATCH v2] " Michele Ballabio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).