Date: Thu, 9 Oct 2008 07:00:13 GMT From: "Dorr H. Clark" <dclark@engr.scu.edu> To: freebsd-bugs@FreeBSD.org Subject: Re: gnu/105221: grep(1): `grep -w -F ""` issue Message-ID: <200810090700.m9970DNZ048308@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR gnu/105221; it has been noted by GNATS. From: "Dorr H. Clark" <dclark@engr.scu.edu> To: bug-followup@FreeBSD.org Cc: freebsd-bugs@FreeBSD.org, martinko <gamato@users.sourceforge.net> Subject: Re: gnu/105221: grep(1): `grep -w -F ""` issue Date: Wed, 8 Oct 2008 23:53:08 -0700 (PDT) gnu/105221 The behavior described in 105221 is due to 'grep' looping infinitely within Fexecute() of revision 1.25 of search.c. When used with the combination of '-w' and '-F' and the empty string, 'grep' enters a inescapable "while(1)" block A proposed fix then, is to immediately fail the search for a match when grep is called with this combination of options if the string to match is zero-length (and thus, trivially does not match the non-empty input!). David K Lam Engineer Dorr H. Clark Advisor Graduate School of Engineering Santa Clara University Santa Clara, CA http://www.cse.scu.edu/~dclark/coen_284_FreeBSD/105221.txt --- /usr/src/gnu/usr.bin/grep/search.c 2006-02-19 04:27:39.000000000 +0000 +++ search.c 2008-08-21 00:29:38.000000000 +0000 @@ -959,6 +959,10 @@ } else if (match_words) { + + if(beg[len-1] == eol) + break; + while (1) { int word_match = 0;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810090700.m9970DNZ048308>