The name of the C locale w/ UTF-8 support is not always C.UTF-8.

Use a pattern to find it (if present) and use that value instead
of hard-coding C.UTF-8.  This works around a leak sanitizer crash
on certain inputs.
This commit is contained in:
Todd C. Miller
2022-11-11 07:05:21 -07:00
parent 75008a0570
commit 5683fc6f7a
8 changed files with 68 additions and 107 deletions

View File

@@ -36,7 +36,7 @@ cross_compiling = @CROSS_COMPILING@
# Compiler & tools to use
CC = @CC@
LIBTOOL = @LIBTOOL@
GREP = @GREP@
EGREP = @EGREP@
SED = @SED@
AWK = @AWK@
@@ -228,11 +228,9 @@ check-fuzzer:
check: $(TEST_PROGS) check-fuzzer
@if test X"$(cross_compiling)" != X"yes"; then \
if locale -a 2>&1 | $(GREP) '^C.UTF-8$$' >/dev/null 2>&1; then \
LC_ALL=C.UTF-8; export LC_ALL; \
else \
LC_ALL=C; export LC_ALL; \
fi; \
l=`locale -a 2>&1 | $(EGREP) -i '^C.UTF-?8$$'`; \
test -n "$$l" || l="C"; \
LC_ALL="$$l"; export LC_ALL; \
unset LANG || LANG=; \
unset LANGUAGE || LANGUAGE=; \
MALLOC_OPTIONS=S; export MALLOC_OPTIONS; \