diff options
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | src/grep.c | 8 | ||||
-rwxr-xr-x | tests/utf8-bracket | 12 |
3 files changed, 16 insertions, 8 deletions
@@ -12,8 +12,8 @@ GNU grep NEWS -*- outline -*- grep no longer reads from uninitialized memory or from beyond the end of the heap-allocated input buffer. This fix addressed CVE-2015-1345. - With -z, '.' in a pattern now consistently matches newline. - Previously, it sometimes matched newline, and sometimes did not. + With -z, '.' and '[^x]' in a pattern now consistently match newline. + Previously, they sometimes matched newline, and sometimes did not. [bug introduced in grep-2.4] When the JIT stack is exhausted, grep -P now grows the stack rather @@ -1862,15 +1862,17 @@ static void Gcompile (char const *pattern, size_t size) { GEAcompile (pattern, size, - RE_SYNTAX_GREP | RE_DOT_NEWLINE | RE_NO_EMPTY_RANGES); + ((RE_SYNTAX_GREP | RE_DOT_NEWLINE | RE_NO_EMPTY_RANGES) + & ~RE_HAT_LISTS_NOT_NEWLINE)); } static void Ecompile (char const *pattern, size_t size) { GEAcompile (pattern, size, - (RE_SYNTAX_POSIX_EGREP | RE_DOT_NEWLINE - | RE_NO_EMPTY_RANGES | RE_UNMATCHED_RIGHT_PAREN_ORD)); + ((RE_SYNTAX_POSIX_EGREP | RE_DOT_NEWLINE + | RE_NO_EMPTY_RANGES | RE_UNMATCHED_RIGHT_PAREN_ORD) + & ~RE_HAT_LISTS_NOT_NEWLINE)); } static void diff --git a/tests/utf8-bracket b/tests/utf8-bracket index f5c4a60d..b63afbb8 100755 --- a/tests/utf8-bracket +++ b/tests/utf8-bracket @@ -24,9 +24,15 @@ printf '1\n2\n' >in || framework_failure_ fail=0 for locale in C en_US.UTF-8; do - for pattern in '1.2' '[12].2' '[1-2].2'; do - for suffix in '' '\(\)\1'; do - LC_ALL=$locale grep --null-data --quiet "$pattern$suffix" in || fail=1 + for options in -qz -qzE; do + case $options in + *E*) parens='()';; + *) parens='\(\)';; + esac + for pattern in '1.2' '[12].2' '[1-2].2' '[1-2][^a][1-2]'; do + for suffix in '' "$parens\\1"; do + LC_ALL=$locale grep $options "$pattern$suffix" in || fail=1 + done done done done |