bug-grep
[Top][All Lists]
Advanced

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

bug#17245: GREP BUG: grep -P and binary files


From: damon
Subject: bug#17245: GREP BUG: grep -P and binary files
Date: Fri, 11 Apr 2014 16:47:03 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

Hi there -

I recently noticed a bug after upgrading grep and have tracked it
through a few versions now.

I was using grep -P (PCRE grep) in some scripts to grep through
directory of files, and the process would keep aborting with a
segmentation fault.

The last known good version is grep-2.14.  Every version after that has
failed in a slightly different way, making me think this could be a bug
in grep, not in pcre.

I tried compiling greps 2.14 through 2.18 against the latest pcre
library, pcre-8.33.  Here's what happens when i try each version against
a random binary file, attached to this message as test-image.png.  This
file was just one of many that caused the errors, though not every
binary file does.

Below are some results demonstrating what's going wrong.  Note that all
of these seem to work fine with regular grep or with grep -E.  Please
let me know what else i can do to help track this down!

# grep-2.14/src/grep -P '\[.?max' test-image.png
(works, does not match)

# grep-2.15/src/grep -P '\[.?max' test-image.png
Aborted

# grep-2.16/src/grep -P '\[.?max' test-image.png
Binary file test-image.png matches
(erroneous - should not match)

# grep-2.16/src/grep -P '.?max' test-image.png
Segmentation fault

# grep-2.17/src/grep -P '\[.?max' test-image.png
Segmentation fault

# grep-2.18/src/grep -P '\[.?max' test-image.png
Segmentation fault

# grep-2.18/src/grep -P '.?ma' test-image.png
Segmentation fault

# grep-2.18/src/grep -P '.?m' test-image.png
Binary file test-image.png matches

-damon

Attachment: test-image.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]