buggrep - Bugs: bug #13847, memchr() not checked on Pexecute()...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #13847: memchr() not checked on Pexecute() - leads to segfault

Submitter:  Shlomi Fish <shlomif>
Submitted:  Tue 19 Jul 2005 07:57:04 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Works For Me
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Thu 28 Jul 2005 10:56:00 PM UTC, comment #2: 

I have created a new tests/pcre.sh file with such a test.  The bug was already fixed, so I am now closing this.

Charles Levert <charles_levert>
Sat 23 Jul 2005 02:07:48 AM UTC, comment #1: 

Although this bug is already fixed in CVS, the attached patch suggests the idea of adding a test for it.

The test itself can probably be shortened to just

echo | ${GREP} -P '\s*$' > /dev/null 2>&1

and a check of the return value in $? (it segfaults when the bug is there).  I leave the * in the pattern since we may eventually want to alter the -P behavior to perform the equivalent of a Perl chomp on each input line before attempting the match (and of a Perl print "$_\n" when the line matches).

Should we add a tests/pcre.sh file with a guard at the beginning to detect if grep was even compiled with HAVE_LIBPCRE and silently skip the whole test file if it wasn't?

Charles Levert <charles_levert>
Tue 19 Jul 2005 07:57:04 AM UTC, original submission:  

There is a call to memchr() in Pexecute (in search.c) which is not checked for NULL return value, and as a result can crash the program.

The attached patch fixes the problem. Note that the added test was not tested, because I could not get the GNU Build System to re-build the build-files on my system.

Shlomi Fish <shlomif>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #3255:  grep-patch.diff added by shlomif (2KiB - text/x-diff - Patch to correct the problem.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 3 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-07-28 charles_levert Open/ClosedOpen Closed
2005-07-23 charles_levert StatusNone Works For Me
2005-07-19 shlomif Attached File- Added grep-patch.diff, #2726

Back to the top

Powered by Savane 3.13-3230.
Corresponding source code