[PATCH 2/2] regex: fix minor over-allocation

2022-03-11 Thread Paul Eggert
* lib/regexec.c (push_fail_stack): Fix off-by-one error that over-allocated the stack. --- ChangeLog | 4 lib/regexec.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 50f60c6372..7a6ade78c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +

[PATCH 1/2] regex: fix free_fail_stack undefined behavior

2022-03-11 Thread Paul Eggert
* lib/regexec.c (push_fail_stack): Don’t increment number of re_fail_stack_t entries until after successful allocation. This prevents a crash if re_realloc or re_malloc fails here, and a later free_fail_stack examines regs or a later pop_fail_stack examines node. Problem discovered by Coverity sc

[patch v2] glob: resolve DT_UNKNOWN via is_dir

2022-03-11 Thread DJ Delorie
[v2: changed malloc failure from ignore to error; added support for alloca; tested by copying to glibc and testing there] The DT_* values returned by getdents (readdir) are only hints and not required. In fact, some Linux filesystems return DT_UNKNOWN for most entries, regardless of actual type

Re: [patch v2] glob: resolve DT_UNKNOWN via is_dir

2022-03-11 Thread Paul Eggert
Thanks for looking into this; it's long been on my plate but I haven't had time to work on the proper solution, which is basically to rewrite glob from scratch (this should make it considerably faster). As far as your patch goes: Gnulib prefers spaces to tabs. The code unnecessarily calls str

[PATCH] regex: fix double-free

2022-03-11 Thread Paul Eggert
* lib/regex_internal.c (re_dfa_add_node): Don’t free storage twice if an allocation fails. --- ChangeLog| 4 lib/regex_internal.c | 22 ++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a6ade78c3..4d49a824e5 10064