[Bug 175314] [regression] bsdgrep(1) broken multidot escaping since r225435

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Jan 21 00:09:38 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=175314

Kyle Evans <bsdports at kyle-evans.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bsdports at kyle-evans.net

--- Comment #1 from Kyle Evans <bsdports at kyle-evans.net> ---
Created attachment 179167
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=179167&action=edit
Proposed patch to address bsdgrep abusing memory

This was irritating to track down. There were two major problems here:

1.) wescmap was being built on top of uninitialized memory -- therefore, every
dot was theoretically escaped with junk=true
2.) The pre-processed pattern never makes it to fg->pattern, so escmap (also
uninitialized memory) was being built based on the processed pattern (without
escapes)

This caused mass-hilarity and there's no way this could have worked since
import. Attached patch addresses both issues by switching both xmalloc()'s to
xcalloc and making a copy of the original pat (sans start marker at least) to
examine for escapes.

I also touched formatting a bit in the area that I had to make more changes to,
because it was difficult to parse through at first.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list