322586 |
16-Aug-2017 |
kevans |
bsdgrep: fix escape map building when using TRE (BSD_GREP_FASTMATCH)
MFC r317700: bsdgrep: use calloc where appropriate in grep's tre-fastmatch
Also apply style(9) to a related NULL check.
MFC r317701: bsdgrep: correct test sense from r317700
Kyle's change in review D10098 was correct. I introduced the error when extracting a portion of that change.
MFC r317704: bsdgrep: fix escape map building for multibyte strings
In BSD grep, fix escape map building in the regex parser. It was previously using memory not explicitly initialized, and the MBS escape map was being built based on a version of the pattern with escapes already parsed out.
This is Kyle's change, but I restored the broken style that already exists in this file.
Approved by: emaste (mentor, blanket MFC) |
322557 |
16-Aug-2017 |
kevans |
MFC r316492: bsdgrep(1): Rip out "xmalloc" bits
xmalloc was a debug malloc implementation, but the x{malloc,calloc,free} functions default to calling the malloc(3) equivalents.
Instead of relying on this malloc shim, we can devise better ways to debug malloc issues that aren't misleading upon initial inspection. (I.e., using jemalloc's various built-in debugging capabilities.)
Approved by: emaste (mentor, blanket MFC) |
303888 |
09-Aug-2016 |
dim |
MFC r303676:
Fix a segfault in bsdgrep when parsing the invalid extended regexps "?" or "+" (these are invalid, because there is no preceding operand).
When bsdgrep attempts to emulate GNU grep in discarding and ignoring the invalid ? or + operators, some later logic in tre_compile_fast() goes beyond the end of the buffer, leading to a crash.
Fix this by bailing out, and reporting a bad pattern instead.
Approved by: re (gjb, kib) Reported by: Steve Kargl |
296799 |
13-Mar-2016 |
ian |
Fix a bug in bsdgrep that caused the program to hang in a tight loop for some combinations of command line options and search patterns. The code was examining regexec flags looking for a regcomp flag value. The fix is to look in the struct field where the decoded regcomp flag was stored when the regex was compiled.
With this fix, it's possible to build WITHOUT_GNU_GREP_COMPAT and WITH_BSDGREP and have a usable GPL-free grep (which of course lacks gnugrep extensions). It now passes the kyua tests except for one test that requires the -z/--null-data gnu extension, and one test involving outputting context lines across multiple files which appears to sometimes output an extra delimiter line ("--") between matches (a rather obscure failure of a rather obscure feature, so bsdgrep should be generally usable now).
|