[PATCH 02/10] regex: avoid undefined behavior

2021-02-05 Thread Paul Eggert
* lib/regexec.c (pop_fail_stack): If the stack is empty, return -1 instead of indulging in undefined behavior. This simplifies callers, and avoids undefined behavior in some cases (see glibc bug 11053, though this change does not fix that overall bug). --- ChangeLog | 6 ++ lib/regexec.c

[PATCH 06/10] regex: avoid duplicate in espilon closure

2021-02-05 Thread Paul Eggert
* lib/regcomp.c (calc_eclosure_iter): Insert NODE into epsilon closure first rather than last. Otherwise, the epsilon closure might contain a duplicate of NODE. --- ChangeLog | 5 + lib/regcomp.c | 8 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/Chan

[PATCH 07/10] regex: fix longstanding backref match bug

2021-02-05 Thread Paul Eggert
This fixes a longstanding glibc bug concerning backreferences (2009-12-04). * lib/regexec.c (proceed_next_node, push_fail_stack) (pop_fail_stack): Push and pop the previous registers as well as the current ones. All callers changed. (set_regs): Also pop if CUR_NODE h

[PATCH 03/10] regex: minor refactoring

2021-02-05 Thread Paul Eggert
* lib/regexec.c (proceed_next_node): Use more-local decls. --- ChangeLog | 3 +++ lib/regexec.c | 14 ++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6fcd5819f..fdc107673 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2021-02-

[PATCH 09/10] regex-tests: add bug 11053 test

2021-02-05 Thread Paul Eggert
* tests/test-regex.c (main): New test case for glibc bug 11053. --- ChangeLog | 3 +++ tests/test-regex.c | 29 + 2 files changed, 32 insertions(+) diff --git a/ChangeLog b/ChangeLog index 69abc35dc..d838ad0d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1

[PATCH 01/10] regex: improve comments

2021-02-05 Thread Paul Eggert
* lib/regexec.c: Add and correct comments about return values. --- ChangeLog | 5 + lib/regexec.c | 21 + 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 717e51b16..fef04a89c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,

[PATCH 08/10] regex: debug check for set member duplicates

2021-02-05 Thread Paul Eggert
* lib/regex_internal.c (re_node_set_insert): Add a DEBUG_ASSERT that would have caught some recently-fixed performance bugs that caused sets to contain duplicate members. --- ChangeLog| 5 + lib/regex_internal.c | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/Chan

[PATCH 04/10] regex: make it easier to merge into glibc

2021-02-05 Thread Paul Eggert
* lib/regex_internal.h [_LIBC]: Do not include Gnulib’s dynarray.h. --- ChangeLog| 3 +++ lib/regex_internal.h | 5 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fdc107673..82aa61a04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @

[PATCH 05/10] regex-tests: fix typo

2021-02-05 Thread Paul Eggert
* tests/test-regex.c (main): Fix typo that would have caused an old test case to report incorrect values on failure. --- ChangeLog | 4 tests/test-regex.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 82aa61a04..f4583e0af 100644 --

[PATCH 10/10] regex: fix comment location

2021-02-05 Thread Paul Eggert
* lib/regexec.c (update_regs): Move comment. --- ChangeLog | 3 +++ lib/regexec.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d838ad0d0..70e357884 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2021-02-05 Paul Eggert + r