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

Submitted by:  Shlomi Fish <shlomif>
Submitted on:  Tue 19 Jul 2005 07:57:04 AM UTC  
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Works For Me
Privacy: PublicAssigned 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>


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


Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.


Please enter the title of George Orwell's famous dystopian book (it's a date):



Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Thu 28 Jul 2005 10:56:00 PM UTCcharles_levertOpen/ClosedOpen=>Closed
Sat 23 Jul 2005 02:07:48 AM UTCcharles_levertStatusNone=>Works For Me
Tue 19 Jul 2005 07:57:04 AM UTCshlomifAttached File-=>Added grep-patch.diff, #2726

Back to the top

Powered by Savane 3.1-cleanup1