mbox series

[v2,00/12] posix: glob/fnmatch fixes and refactor

Message ID 1517837254-19399-1-git-send-email-adhemerval.zanella@linaro.org
Headers show
Series posix: glob/fnmatch fixes and refactor | expand

Message

Adhemerval Zanella Netto Feb. 5, 2018, 1:27 p.m. UTC
This patchset main target is to remove alloca usage on glob and
fnmatch by using a specialized dynarray for C strings (struct
char_array) along with already in place scratch_buffer and
dynamic_array. 

It does not change any glob semantics, only internal glob buffer
management.  It also does not solve the potential stack overflow
due recursive allocation from wildcard in patterns [1] (although
an option would be go to pure dynamic char_array for this case).

I have added the fnmatch and getlogin_r on this series because
glob uses them internally.

[1] http://lists.gnu.org/archive/html/bug-gnulib/2017-10/msg00056.html

Adhemerval Zanella (11):
  malloc: Add specialized dynarray for C strings
  posix: Use char_array for internal glob dirname
  posix: Remove alloca usage for GLOB_BRACE on glob
  posix: Remove alloca usage on glob dirname
  posix: Use dynarray for globname in glob
  posix: Remove alloca usage on glob user_name
  posix: Use char_array for home_dir in glob
  posix: Remove all alloca usage in glob
  posix: Replace alloca usage with scratch_buffer for fnmatch
  posix: Remove alloca usage for internal fnmatch implementation
  posix: Remove VLA usage for internal fnmatch implementation

Florian Weimer (1):
  getlogin_r: switch Linux variant to struct scratch_buffer

 ChangeLog                            |  47 +++
 malloc/Makefile                      |   4 +-
 malloc/Versions                      |   7 +
 malloc/char_array-impl.c             |  57 ++++
 malloc/char_array-skeleton.c         | 288 ++++++++++++++++
 malloc/char_array.h                  |  53 +++
 malloc/dynarray.h                    |   9 +
 malloc/dynarray_overflow_failure.c   |  31 ++
 malloc/malloc-internal.h             |  14 +
 malloc/tst-char_array.c              | 112 +++++++
 posix/fnmatch.c                      | 143 ++------
 posix/fnmatch_loop.c                 | 230 +++++++------
 posix/glob.c                         | 624 ++++++++++++++---------------------
 sysdeps/unix/sysv/linux/getlogin_r.c |  34 +-
 14 files changed, 1015 insertions(+), 638 deletions(-)
 create mode 100644 malloc/char_array-impl.c
 create mode 100644 malloc/char_array-skeleton.c
 create mode 100644 malloc/char_array.h
 create mode 100644 malloc/dynarray_overflow_failure.c
 create mode 100644 malloc/tst-char_array.c

-- 
2.7.4