Re: git grep '(' = segfault

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dmitry Potapov <dpotapov@xxxxxxxxx> wrote:

> Hi,
> 
> I have tried a few version of Git and got "Segmentation fault" when
> run:
> 
> $ git grep '('
> 
> I am not very familiar with grep code and don't have time to dig
> into it right now. So, maybe someone else can take a look at it.
> 
> Thanks,
> Dmitry
> --

Try this patch, however I'm not sure if it is correct.

---

diff --git a/grep.c b/grep.c
index f3a27d7..5748355 100644
--- a/grep.c
+++ b/grep.c
@@ -84,10 +84,10 @@ static struct grep_expr *compile_pattern_atom(struct grep_pat **list)
 	case GREP_OPEN_PAREN:
 		*list = p->next;
 		x = compile_pattern_or(list);
-		if (!x)
-			return NULL;
 		if (!*list || (*list)->token != GREP_CLOSE_PAREN)
 			die("unmatched parenthesis");
+		if (!x)
+			return NULL;
 		*list = (*list)->next;
 		return x;
 	default:
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]