bin/181263: grep crashes at memchr/__sfvwrite when using colors

kenorb kenorb at gmail.com
Tue Aug 13 13:40:00 UTC 2013


>Number:         181263
>Category:       bin
>Synopsis:       grep crashes at memchr/__sfvwrite when using colors
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 13 13:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     kenorb
>Release:        OSX
>Organization:
>Environment:
>Description:
BSD grep is crashing on different behavior when using --colors parameter.
Check the below examples.

Related posts:
http://lists.freebsd.org/pipermail/freebsd-current/2011-August/026502.html
http://stackoverflow.com/questions/17247142/grep-f-on-os-x-produces-segfault/18210372
>How-To-Repeat:
1.
$ echo 'abcd*' | grep --color=auto -e ".*" -e a
Segmentation fault: 11

2.
$ echo "fojeiwuroiuwet\nljfajsljkfabcdddjlfkajlkj\nabcaaa\nzzzabc\n" | grep --color -f grepfile
Segmentation fault: 11

3.
echo 'abcd*' > grepfile
echo 'abc$' >> grepfile
echo '^abc' >> grepfile
echo "fojeiwuroiuwet\nljfajsljkfabcdddjlfkajlkj\nabcaaa\nzzzabc\n" | grep --color=auto -f grepfile
>Fix:
Don't use colors e.g.
--color=never

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list